日期:2014-05-17  浏览次数:21098 次

字段太小而不能接受所要添加的数据的数量。试着插入或粘贴较少的数据(asp.net 新建台帐点击保存时出的错)
C# code

protected void Button2_Click(object sender, EventArgs e)
    {
        if (TextBox1.Text == "" || TextBox2.Text == "" || TextBox3.Text == "" || TextBox4.Text == "")
        {
            Response.Write("<script>alert(\"单价,数量,供货商家都不能为空\")</script>");
            return;
        }
        OleDbConnection sqlcon = new OleDbConnection("provider=Microsoft.Jet.Oledb.4.0;Data Source=" + Server.MapPath("/MISWeb/database/database.mdb"));
        sqlcon.Open();
        
 第45行       String sql3 = "insert into M_UM_OFFIDETAIL(BOOK_ID,CODE_TYPE,IN_OUT_DATE,PRICE,QUANTITY,OPERATOR,SECTOR,REGISTRAR,OPER_DATE)values(@BOOK_ID,@CODE_TYPE,@IN_OUT_DATE,@PRICE,@QUANTITY,@OPERATOR,@SECTOR,@REGISTRAR,@OPER_DATE))";
        OleDbCommand cmd3 = new OleDbCommand(sql3, cmd3);


        //cmd3.Parameters.Add("@BOOK_ID", OleDbType.Char).Value = TextBox1d.Text;//办公用品台帐ID    对应台帐记录的ID    自动取值    不显示,不可修改。


        cmd3.Parameters.Add("@CODE_TYPE", OleDbType.Char).Value = 1;            //明细类型代码
        cmd3.Parameters.Add("@IN_OUT_DATE", OleDbType.Char).Value = DateTime.Now.ToShortDateString(); //出入库日期
        cmd3.Parameters.Add("@PRICE", OleDbType.Char).Value=TextBox1.Text;                 //单价
        cmd3.Parameters.Add("@QUANTITY", OleDbType.Char).Value=TextBox2.Text;              //数量
        cmd3.Parameters.Add("@OPERATOR", OleDbType.Char).Value=TextBox3.Text;              //业务员
        cmd3.Parameters.Add("@REGISTRAR", OleDbType.Char).Value=TextBox4.Text;             //登记人
        cmd3.Parameters.Add("@OPER_DATE", OleDbType.Char).Value=TextBox5.Text;             //登记日期
        
        cmd3.ExecuteNonQuery();
        conn.Close();

        OleDbConnection shuliang = new OleDbConnection("provider=Microsoft.Jet.Oledb.4.0;Data Source=" + Server.MapPath("/MISWeb/database/database.mdb"));
        shuliang.Open();
        string sl = TextBox2.ToString();
        //String sl =update M_UM_OFFIBOOK set STOCKS = STOCKS + '"s"' where 

        
    }




------解决方案--------------------
我是来接分的~~