本文介绍了nvarchar值'3391569654'的转换溢出了一个int列。该语句已终止。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

     protected void btnEdit_Click(object sender, EventArgs e)
        {
            try
            {   SqlConnection mysqlconection = new SqlConnection(myconect);
                SqlDataAdapter myadp = new SqlDataAdapter();
                myadp.UpdateCommand = new SqlCommand("Update [tbl_CustInfo] Set [mydate]=@mydate,[name]=@name,[idnasb]=@idnasb,[iddevice]=@iddevice,[email]=@email,[mobile]=@mobile,[tel]=@tel,[Adress]=@Adress WHERE [codemeli]=" + txtcodemeli.Text, mysqlconection);
                mydat = dryear.SelectedItem.Value.ToString() + "/" + drmonth.SelectedItem.Value.ToString() + "/" + drday.SelectedItem.Value.ToString();
                myadp.UpdateCommand.Parameters.Add("@mydate", SqlDbType.NVarChar, 15).Value = mydat;
                myadp.UpdateCommand.Parameters.Add("@name", SqlDbType.NVarChar, 100).Value = txtname.Text;
                myadp.UpdateCommand.Parameters.Add("@idnasb", SqlDbType.Int).Value = dridnasb.SelectedIndex;
                myadp.UpdateCommand.Parameters.Add("@iddevice", SqlDbType.Int).Value = drdevice.SelectedIndex;
                myadp.UpdateCommand.Parameters.Add("@email", SqlDbType.NVarChar, 50).Value = txtemail.Text.ToString();
                myadp.UpdateCommand.Parameters.Add("@mobile", SqlDbType.NVarChar, 11).Value = txtmobile.Text.ToString();
                myadp.UpdateCommand.Parameters.Add("@tel", SqlDbType.NVarChar, 11).Value = txttel.Text.ToString();
                myadp.UpdateCommand.Parameters.Add("@adress", SqlDbType.NVarChar, 250).Value = txtAdress.Text;
                myadp.UpdateCommand.Connection = mysqlconection;
                mysqlconection.Open();
                myadp.UpdateCommand.ExecuteNonQuery();
                mysqlconection.Close();
            }
            catch (Exception ex)
            {
                errorLabel.Text = ex.Message;
                errorLabel.Visible = true;
            }
        }

What I have tried:

// when click edit Button i see above error message
// can you  tell me what is problem

推荐答案


这篇关于nvarchar值'3391569654'的转换溢出了一个int列。该语句已终止。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-12 11:26