字符串或二进制数据将被截断吗? [英] string or binary data would be truncated?why

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

问题描述

任何人都可以纠正以下错误.


错误:

字符串或二进制数据会被截断吗?

错误编码:

Can Anyone rectify below error.


Error:

string or binary data would be truncated?

Error coding:

  protected void btnsubmit_Click(object sender, EventArgs e)
{
    if (con.State == ConnectionState.Closed)
    {
        con.Open();
    }
    string ship;
    if (radioshippinglist.SelectedItem.Value == "Yes")
    {
        ship = txtship.Text;
    }
    else
    {
        ship = "0";
    }
    SqlCommand cmd = new SqlCommand("insert into delivery values('" + ddlcountry.SelectedItem.Value + "','" + ddlstate.SelectedItem.Value + "','" + txtarea.Text + "','" + txtsubarea.Text + "'+','" + txtdeliverycharges.Text + "','" + txttax.Text + "','" +ship + "','A')", con);
    cmd.ExecuteNonQuery();
    con.Close();
    lblmsg.Text = "Submitted";
}

推荐答案



检查您要插入到交付表中的值是否在数据库列数据类型范围内

例如:如果交货表中的发运专栏是varchar(10),而您尝试插入一个超过10个字符的值,则它将抛出这样的错误.以这种方式检查一次

希望这对您有帮助
Hi

Check whether the values you are trying to insert into the deliveries table are within database column data type range

Eg: If your ship column in deliveries table is varchar(10) and you trying to insert a value of more than 10 characters then it will throw error like this. Check once in this way

Hope this helps


我认为您输入的TextBox值比数据库要多
长度.
您要检查吗?
I think you are entered TextBox value more than database
length.
are you check this?


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

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