INSERT using parameters, what about datatypes?
Posted by: Brian Wengel
Date: January 28, 2016 06:23AM

When creating a parameter e.g. to be used in an INSERT statement, the short version is to just specify the parameterName and an value-object e.g.

DBCMD.Parameters.AddWithValue("@date", MyDateOject)

But can I trust the .Net MySQL connector will correctly convert the data saved in the MyDataObject to the right MySqlDbType used in the target table field?

Lets say MyDateOject have a value of .Net DateTime and the target field is MySqlDbType.Date (have no time)....will that work?

And will boolean be converted correctly if target field is MySqlDbType.Bit(1)

I know I can construct the parameter setting the MySqlDbType explicit but if I can trust the "automatic" conversion that would be the easiest way.

Options: ReplyQuote


Subject
Written By
Posted
INSERT using parameters, what about datatypes?
January 28, 2016 06:23AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.