Quantcast
Channel: MySQL Forums - Connector/NET and C#, Mono, .Net
Viewing all articles
Browse latest Browse all 1451

INSERT using parameters, what about datatypes? (1 reply)

$
0
0
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.

Viewing all articles
Browse latest Browse all 1451

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>