id int the growth
The Name nvarchar (200) an empty
Encoder type varbinary nullable
Record the following:
Id name Encoder
1 Peter NULL
In the code, the use of:
SqlParameter param []={
New SqlParameter (" @ the Name ", the item Name),//item. The Name of James
New SqlParameter (" @ Encoder, "item. The Encoder) item. The Encoder or NULL
};
Var strUpdate="UPDATE A SET name=@ name, Encoder=@ Encoder WHERE id=1";
DbHelper. ExecuteNonQuery (strUpdate, CommandType. Text, param);
Above, perform error report: Implicit conversion from data type nvarchar to varbinary is not allowed. Use the CONVERT function to run this query.
Could you tell me how to change parameters should be? Thank you very much!!
CodePudding user response:
Your incoming is an empty string, not NULLCodePudding user response:
Thank you, have been solved,,CodePudding user response: