[英]Getting error:Operand type clash: nvarchar is incompatible with image
[英]Operand type clash: nvarchar is incompatible with image for Null Image
我有以下代码:我收到以下错误消息:
Operand type clash: nvarchar is incompatible with image
当代码尝试执行时: cmd.ExecuteNonQuery();
请注意,只有当_ImageB
为null
时,我才会收到此错误。 ImageB
作为图像数据类型存储在SQL Server表中。
if (_ImageB == null)
{
cmd.Parameters.AddWithValue("@ImageB", DBNull.Value);
}
else
{
cmd.Parameters.AddWithValue("@ImageB", _ImageB);
}
尝试这个!
cmd.Parameters.Add("@ImageB", SqlDbType.Image).Value = _ImageB == null ? DBNull.Value : _ImageB;
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.