异常详细信息: System.Data.OleDb.OleDbException: 标准表达式中数据类型不匹配。
代码如下://连接数据库stringStraddcon=Server.MapPath("kocooldb.mdb");OleDbConnectionsqlcon=newO...
代码如下:// 连接数据库 string Straddcon = Server.MapPath("kocooldb.mdb"); OleDbConnection sqlcon = new OleDbConnection("PROVIDER=Microsoft.Jet.OLEDB.4.0;DATA Source=" + Straddcon); sqlcon.Open(); string StrInsert = "insert into tb_khly(titles,contents,dates,userip,call,email,sfsh) values(@title,@contents,@dates,@userip,@call,@email,0)"; OleDbCommand cmd = new OleDbCommand(StrInsert, sqlcon); cmd.Parameters.Add("@title", OleDbType.VarChar, 50); cmd.Parameters["@title"].Value = this.TextBox1.Text.ToString(); cmd.Parameters.Add("@contents", OleDbType.VarChar, 500000); cmd.Parameters["@contents"].Value = this.FreeTextBox1.ViewStateText.Replace("'", "''"); cmd.Parameters.Add("@dates", OleDbType.VarChar, 50); cmd.Parameters["@dates"].Value = DateTime.Now.ToString(); cmd.Parameters.Add("@userip", OleDbType.VarChar, 50); cmd.Parameters["@userip"].Value = GetClientIP(); cmd.Parameters.Add("@call", OleDbType.VarChar, 50); cmd.Parameters["@call"].Value = this.TextBox4.Text.ToString(); cmd.Parameters.Add("@email", OleDbType.VarChar, 50); cmd.Parameters["@email"].Value = this.TextBox3.Text.ToString(); // 执行插入数据的操作 cmd.ExecuteNonQuery(); //提示这步出错
展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询