I have a database with an unsigned integer column.
But, in the enumeration of MySqlType, I don't see any of the unsigned types.
In order to perform parameterized queries, which type am I supposed to use to create the parameter ?
Where are the unsigned numeric types ? How do I use them?
-
- Posts: 37
- Joined: Tue 30 Jan 2007 07:43
-
- Posts: 37
- Joined: Tue 30 Jan 2007 07:43
Really?, welll, my code returns me an error, when I do that:
An exception of type 'System.InvalidCastException' occurred in CoreLab.Data.dll but was not handled in user code
Additional information: Cannot convert parameter value of type 'System.UInt32' to MySQL type 'MySqlType.Int'.
This is the first time I'm trying to use a data type not directly supported in the DbType enumeration.
I'd appreciate a snippet.
An exception of type 'System.InvalidCastException' occurred in CoreLab.Data.dll but was not handled in user code
Additional information: Cannot convert parameter value of type 'System.UInt32' to MySQL type 'MySqlType.Int'.
Code: Select all
uint unsig = 4000000000;
MySqlParameter myp = new MySqlParameter("_UInt32Col", MySqlType.Int);
myp.Value = unsig;
comm.Parameters.Add(myp);
I'd appreciate a snippet.
This happened because you used boundary value. I suggest you not using MySqlType enumeration at all:
Code: Select all
uint unsig = 4000000000;
MySqlParameter myp = new MySqlParameter("_UInt32Col", unsig);
comm.Parameters.Add(myp);