Bug #11928 Overflow exception when using MySql.DbType.Byte in Parameter
| Submitted: | 13 Jul 2005 23:33 | Modified: | 14 Jul 2005 2:10 |
|---|---|---|---|
| Reporter: | James Duerr | Email Updates: | |
| Status: | Not a Bug | Impact on me: | |
| Category: | Connector / NET | Severity: | S3 (Non-critical) |
| Version: | 1.0.4 | OS: | Windows (Windows XP Home) |
| Assigned to: | CPU Architecture: | Any |
[13 Jul 2005 23:40]
James Duerr
Nevermind, I should be using ubyte not byte datatype. Unfortunately the "non-standard" with this from C# perspective (Byte being unsigned and SByte being signed, where all others Uvariable is the unsigned version and as standard it's signed).
[14 Jul 2005 2:10]
Reggie Burnett
No problem. It is backwards and confusing.
Portions of this website are copyright © 2001, 2002 The PHP Group
Page generated in 0.110 sec. using MySQL 8.4.7-u6-cloud
Timestamp references displayed by the system are UTC.
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.
Description: When storing Byte variables to my database, if I set the byte value beyond what an SByte can handle, I get a Overflow exception from the Serialize function in MySqlByte (see exception) Unhandled Exception: System.OverflowException: Value was either too large or too small for a signed byte. at System.Convert.ToSByte(Byte value) at System.Byte.System.IConvertible.ToSByte(IFormatProvider provider) at System.Convert.ToSByte(Object value) at MySql.Data.Types.MySqlByte.Serialize(PacketWriter writer, Boolean binary, Object value, Int32 length) at MySql.Data.MySqlClient.MySqlParameter.Serialize(PacketWriter writer, Boolean binary) at MySql.Data.MySqlClient.MySqlCommand.SerializeParameter(PacketWriter writer, String parmName) at MySql.Data.MySqlClient.MySqlCommand.PrepareSqlBuffers(String sql) at MySql.Data.MySqlClient.MySqlCommand.ExecuteNonQuery() How to repeat: Parameter is as follows private MySqlParameter pParam_LookupValueFilter1 = new MySqlParameter("?LookupValueFilter1",MySqlDbType.Byte); Code to insert is myInsert.Parameters.Add(ParamSortKey); myInsert.ExecuteNonQuery(); Suggested fix: Shouldn't the entire Byte function series use byte not SByte?