gpt4 book ai didi

c# - 字符串或二进制数据将在 Linq 中被截断

转载 作者:太空宇宙 更新时间:2023-11-03 21:39:40 25 4
gpt4 key购买 nike

我正在处理我的项目,但在执行 dbm.SubmitChanges() 时出现“字符串或二进制数据将被截断”错误;

privatevoid btn_ok_Click(object sender, EventArgs e)
{
myDataClasses_LinqDataContext dbm = newmyDataClasses_LinqDataContext();
myDataClasses_LinqDataContext dbp = newmyDataClasses_LinqDataContext();
if (rdo_main.Checked == true)
{
string sh_shenase = txtshenase.Text;
string name = txtname.Text;
string family = txtfamily.Text;
string sh_shenasname = txtshenasname.Text;
string sh_meli = txtshmeli.Text;
string tt_ruz = cmbroz.Text;
string tt_mah = cmbmah.Text;
string tt_sal = cmbsal.Text;
string loc_tavalod = cmbshahr.Text;
string name_pedar = txtfathername.Text;
string vaz_tahol = cmbvaztahol.Text;
string sh_pishtel = txtshPtamas.Text;
string sh_tel = txtshtamas.Text;
string mobile = txtshmobile.Text;
string email = txtemail.Text;
string address = txtaddres.Text;
string mov_nazari = txtmovazafi_nazari.Text;
string mov_amali = txtmovazafi_amali.Text;

MemoryStream ms = newMemoryStream();
pictureBox1.Image.Save(ms, pictureBox1.Image.RawFormat);
byte[] arrpic = ms.GetBuffer();
tbl_pro_main tbl = newtbl_pro_main()
{
address = address,
birth_date = tt_ruz,
birth_loc = loc_tavalod,
birth_month = tt_mah,
birth_year = tt_sal,
bound_a = mov_amali,
bound_n = mov_nazari,
email = email,
family = family,
id = sh_shenasname,
m_status = vaz_tahol,
mobile_num = mobile,
n_cod = sh_meli,
name = name,
name_father = name_pedar,
phone_num = sh_tel,
phone_pnum = sh_pishtel,
pic = arrpic,
username = sh_shenase
};
dbm.tbl_pro_mains.InsertOnSubmit(tbl);
**dbm.SubmitChanges();**// error `String or binary data would be truncated`!!!!!
MessageBox.Show("success!", MessageBoxButtons.OK, MessageBoxIcon.Information);
}
elseif (rdo_public.Checked ==true)
{
string sh_shenase = txtshenase.Text;
string name = txtname.Text;
string family = txtfamily.Text;
string sh_shenasname = txtshenasname.Text;
string sh_meli = txtshmeli.Text;
string tt_ruz = cmbroz.Text;
string tt_mah = cmbmah.Text;
string tt_sal = cmbsal.Text;
string loc_tavalod = cmbshahr.Text;
string name_pedar = txtfathername.Text;
string vaz_tahol = cmbvaztahol.Text;
string sh_pishtel = txtshPtamas.Text;
string sh_tel = txtshtamas.Text;
string mobile = txtshmobile.Text;
string email = txtemail.Text;
string address = txtaddres.Text;
string mov_nazari = txtmovazafi_nazari.Text;
string mov_amali = txtmovazafi_amali.Text;

MemoryStream ms = newMemoryStream();
pictureBox1.Image.Save(ms, pictureBox1.Image.RawFormat);
byte[] arrpic = ms.GetBuffer();

tbl_pro_public tbl = newtbl_pro_public()
{
address = address,
birth_date = tt_ruz,
birth_loc = loc_tavalod,
birth_month = tt_mah,
birth_year = tt_sal,
bound_a = mov_amali,
bound_n = mov_nazari,
email = email,
family = family,
id = sh_shenasname,
m_status = vaz_tahol,
mobile_num = mobile,
n_cod = sh_meli,
name = name,
name_father = name_pedar,
phone_num = sh_tel,
phone_pnum = sh_pishtel,
pic = arrpic,
username = sh_shenase
};
dbp.tbl_pro_publics.InsertOnSubmit(tbl);
dbp.SubmitChanges();

MessageBox.Show("success!", MessageBoxButtons.OK, MessageBoxIcon.Information);
}
else
MessageBox.Show("success!", MessageBoxButtons.OK, MessageBoxIcon.Warning);
}

最佳答案

这意味着您的某个字段被太长的值溢出了。根据您的列定义检查您的输入

关于c# - 字符串或二进制数据将在 Linq 中被截断,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19989248/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com