[Message Deleted]
-
[Message Deleted]
-
[Message Deleted]
-
Most likely you set only the first element of the array to the parameter, but without seeing the code, it's quite hard to say more.
The need to optimize rises from a bad design.My articles[^]
The byte array is declared "byte[] b = new byte[32];". I set the values with cm.Parameters.AddWithValue( "@binTrack3", b ); and cm.Parameters.Add( "@binTrack3", SqlDbType.Binary, b.Length ).Value = b; Same results. I should also add, I'm using ODBC connection to connect to Sybase and SQLClient connection to connect to SQL Server.
-
The byte array is declared "byte[] b = new byte[32];". I set the values with cm.Parameters.AddWithValue( "@binTrack3", b ); and cm.Parameters.Add( "@binTrack3", SqlDbType.Binary, b.Length ).Value = b; Same results. I should also add, I'm using ODBC connection to connect to Sybase and SQLClient connection to connect to SQL Server.
At a glance, that portion of the code seems fine. Just few questions. Is the column defined fixed length? If it isn't, I think you should use SqlDbType.VarBinary. You've used debugger to observe that length of b is 32 and that it has data on every element at the time when the value assignment is made? Also you could check using debugger that cm.Parameters["@binTrack3"] has the value you suspect just before calling the ExecuteNonQuery.
The need to optimize rises from a bad design.My articles[^]
-
At a glance, that portion of the code seems fine. Just few questions. Is the column defined fixed length? If it isn't, I think you should use SqlDbType.VarBinary. You've used debugger to observe that length of b is 32 and that it has data on every element at the time when the value assignment is made? Also you could check using debugger that cm.Parameters["@binTrack3"] has the value you suspect just before calling the ExecuteNonQuery.
The need to optimize rises from a bad design.My articles[^]
The column is defined as binary. Just for kicks, I tried VarBinary, but I still received the same results. I used the debugger right before ExecuteNonQuery both with SqlDbType.VarBinary and SqlDbType.Binary. It does show the 32-byte array in its entirety.
-
The column is defined as binary. Just for kicks, I tried VarBinary, but I still received the same results. I used the debugger right before ExecuteNonQuery both with SqlDbType.VarBinary and SqlDbType.Binary. It does show the 32-byte array in its entirety.