You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
usingvarcmd=newMySqlCommand("select null;",connection);usingvarreader=cmd.ExecuteReader();reader.Read();reader.GetInt32(0);// InvalidCastException: Specified cast is not valid.reader.GetInt64(0);// InvalidCastException: Unable to cast object of type 'System.DBNull' to type 'System.Int64'.// MySql.Datareader.GetInt32(0);// SqlNullValueException: Data is Null. This method or property cannot be called on Null values.
User at https://stackoverflow.com/q/70132978/23633 was probably not helped by the low-information exception message. Commenters would also probably have been quicker to help him if the GetInt32 message was more like the GetInt64 message.
MySql.Data has a different exception type, which is even more clear; MySqlConnector uses InvalidCastException by design, so it's not necessary to change the exception type but it could have a better message.
The text was updated successfully, but these errors were encountered:
User at https://stackoverflow.com/q/70132978/23633 was probably not helped by the low-information exception message. Commenters would also probably have been quicker to help him if the
GetInt32
message was more like theGetInt64
message.MySql.Data has a different exception type, which is even more clear; MySqlConnector uses
InvalidCastException
by design, so it's not necessary to change the exception type but it could have a better message.The text was updated successfully, but these errors were encountered: