字符串和二进制数据将在更新网格时被截断。 [英] String and binary data would be truncated at update my grid.

查看:59
本文介绍了字符串和二进制数据将在更新网格时被截断。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

亲爱的朋友们,



我在更新屏幕时遇到错误..请在屏幕上显示电话错误。



Dear Frnds,

I have Error during update my Screen.. please tel wats error on my screen.

try
{
    for (int i = 0; i < dgvScreenDetails.Rows.Count-1; i++)
    {
        SqlConnection con = new SqlConnection("Data Source=Param-PC;Initial Catalog=POS;Persist Security Info=True;User ID=sa;Password=123");                          
        con.Open();
        SqlCommand cmd = new SqlCommand("Update  UserCreation set UserId='"+txtUserId.Text+"',UserName='"+txtUserName.Text+"', DepartmentId='"+txtDeptId.Text+"', DepartmentName='"+txtDeptName.Text+"', Password='"+txtPassword+"', ScreenCode='"+dgvScreenDetails.Rows[i].Cells[1].Value+"', ScreenName='"+dgvScreenDetails.Rows[i].Cells[2].Value+"' where UserId='"+txtUserId.Text+"' and ScreenCode='"+dgvScreenDetails.Rows[i].Cells[1].Value+"'", con);

        
       WithValue("@ScreenName", dgvScreenDetails.Rows[i].Cells[2].Value);
        cmd.ExecuteNonQuery();
        con.Close();
    }

    MessageBox.Show("Record Updated");
}



有了问候,

Vivek .R


With Regards,
Vivek .R

推荐答案

当您尝试在列大小之外插入更多字符时,将截断二进制数据。

例如您的列varchar(50)并且您正在插入60个字符

增加列大小
binary data would be truncated comes when you are trying to insert more character beyond your column size.
e.g your column varchar(50) and you are inserting 60 character
simply increase your column size


如果varchar(max)
PLease check YOur Database Size of all Field it must be max if varchar(max)


这篇关于字符串和二进制数据将在更新网格时被截断。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆