protected void Button1_Click(object sender, EventArgs e)
{
OleDbConnection mycoon;
OleDbCommand mycmd;
mycoon = new OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;" +
"Data Source=" + MapPath("App_Data/student.mdb"));
mycoon.Open();
DateTime mydt = new DateTime();
mydt.ToString("yyyy-MM-dd");
mycmd = new OleDbCommand("INSERT INTO [liuyanban] (name,text,time) VALUES ('" + this.Label4.Text + "','" + this.TextBox1.Text + "','" + mydt + "')", mycoon);
mycmd.ExecuteNonQuery();
Response.Write("<script>alert(\"留言成功!\")</script>");
提示mycmd.ExecuteNonQuery();出错..原因是INSERT INTO 语句的语法错误。
求高手指教
一只斗牛犬
守着星空守着你
FFIVE