日期:2014-05-18  浏览次数:20897 次

二进制被截断终止
public   static   string   gettreelist(string   yonghuxinming)
                {
                        string   strtreelist   =   "update   安装信息表   set   用户姓名= 'yonghuxinming ' ";   //where   员工ID=@员工ID   and   员工权限   =   '普通 ' ";
                        return   strtreelist   ;
                }
在另外一个类中
yonghuxinming=this.textbox1.text;
                                sqlcmd.CommandText   =   leiku.connection.gettreelist(yonghuxinming);

                                if   (sqlcmd.ExecuteNonQuery()   >   0)
                                {
                                        MessageBox.Show( "提交成功! ",   "提示: ");
                                }
                                else
                                {
                                        MessageBox.Show( "出错 ");
                                }
为什么说二进制被截断终止,这是为什么啊。
是不是这样写啊 set 用户姓名= 'yonghuxinming '   该怎么写

------解决方案--------------------
应该是 超出字段长度范围了,
你要验证输入数据的长度,
或者把这个字段的长度设置更大一些
------解决方案--------------------
string strtreelist = String.Format( "update 安装信息表 set 用户姓名= '{0} ' ",yonghuxinming);