Inserting Bytearray into SQL through stored procedure called in C#

前端 未结 1 1370
一生所求
一生所求 2020-12-20 08:32

First of all I\'ve tried everything, and can\'t understand why it won\'t update my varbinary field properly.

out of 1728 bytes only the last byte in the byte array i

相关标签:
1条回答
  • 2020-12-20 09:02

    Your sql should be this:

    UPDATE Invenotry
    SET B = @B
    WHERE A = @A
    

    You can also try the full version of a parameter constructor:

    SqlParamter param = new SqlParameter("@B", SqlDbType.VarBinary, 1728, ParameterDirection.Input, 
         // we have these parameters but they are ignored for input types
         false, 0, 0, null, DataRowVersion.Current, 
         // the data
         to_store);
    
    cmd.Parameters.Add(param);
    
    0 讨论(0)
提交回复
热议问题