在Access中插入数据时出现溢出错误

时间:2015-03-03 13:03:49

标签: c# database ms-access

protected void regsubmit_Click(object sender, EventArgs e)
{
    OleDbConnection con = new OleDbConnection("Provider=Microsoft.ACE.OLEDB.12.0;Data Source=F:\\Study\\Websites\\2\\database\\shoplocal.accdb");
    con.Open();
    OleDbCommand cmd = new OleDbCommand("insert into Registration values('" + txtfname.Text + "','" + txtemail.Text + "','" + txtpwd.Text + "','" + txtcnfpwd.Text + "','" + txtcntno.Text + "','" + txtaddrs.Text + "'," + Convert.ToInt32(txtpstlcode.Text) + ")", con);
    int chk = cmd.ExecuteNonQuery();
    if (chk != 0)
    {

        lblmsg.Text = "Registration Successful";

    }

    //OleDbCommand cmd1 = new OleDbCommand("delete * from Inward where Serial_no=" + tb_SLSserial_no.Text + "", con);
    //int chk1 = cmd1.ExecuteNonQuery();
    con.Close();

我在 int chk = cmd.ExecuteNonQuery(); 上遇到 OleDb溢出异常 每当我点击提交按钮。请帮忙。

0 个答案:

没有答案