2010年8月2日星期一

String or binary data would be truncated. The statement has been terminated (COOKIE as SQL parameter)

in ASP.net when using cookie as SQL parameter. if you got "String or binary data would be truncated. The statement has been terminated"

This is probably your c# problem:
WRONG: Request.Cookies["OperatorID"].ToString()
RIGHT:Request.Cookies["OperatorID"].Value.ToString()

if you are not meet this problem with cookie, maybe your field is set too small. try bigger.

COOKIE作SQL参数时,要注意C#写时有.Value这一段.不然,就会出现上述的错误.

没有评论: