ASP.net Access插入内容INSERT INTO 语句的语法错误。着急、、、、
stringconnString="Provider=Microsoft.Jet.OLEDB.4.0;DataSource="+Server.MapPath("demod...
string connString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" +
Server.MapPath("demodata/soademo.mdb");
OleDbConnection MyConnection;
MyConnection = new OleDbConnection(connString);
string strInsert = "insert into DocRecord([Doc_Title],[Doc_Name],[Subject],[Doc_Text],[SubmitTime])values('新文件','"+null+"','"+null+"','" + FreeTextBox1.Text + "','" + System.DateTime.Now + "')";
OleDbCommand MyCommand = new OleDbCommand(strInsert, MyConnection);
MyConnection.Open();
MyCommand.ExecuteNonQuery();
MyConnection.Close();
是我的代码,刚学习请大侠指点啊!! 展开
Server.MapPath("demodata/soademo.mdb");
OleDbConnection MyConnection;
MyConnection = new OleDbConnection(connString);
string strInsert = "insert into DocRecord([Doc_Title],[Doc_Name],[Subject],[Doc_Text],[SubmitTime])values('新文件','"+null+"','"+null+"','" + FreeTextBox1.Text + "','" + System.DateTime.Now + "')";
OleDbCommand MyCommand = new OleDbCommand(strInsert, MyConnection);
MyConnection.Open();
MyCommand.ExecuteNonQuery();
MyConnection.Close();
是我的代码,刚学习请大侠指点啊!! 展开
展开全部
string strInsert = "insert into DocRecord([Doc_Title],[Doc_Name],[Subject],[Doc_Text],[SubmitTime])values('新文件','"+null+"','"+null+"','" + FreeTextBox1.Text + "','" + System.DateTime.Now + "')";改为
string strInsert = "insert into DocRecord(Doc_Title,Doc_Text,SubmitTime)values('新文件','" + FreeTextBox1.Text + "','" + System.DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "')";
string strInsert = "insert into DocRecord(Doc_Title,Doc_Text,SubmitTime)values('新文件','" + FreeTextBox1.Text + "','" + System.DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "')";
追问
不行啊,还是提示说,MyCommand.ExecuteNonQuery();处错误,INSERT INTO 语句的语法错误。
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询