怎样向ACCESS数据库中插入数据?
我建了一个ACCESS数据库login 一个表login 有 stuid,stuname,project,machine 四个字段,我想通过编程向表里添加一条记录,不知道下面这样为什么错?string myConnectionString = "Provider = Microsoft.Jet.OLEDB.4.0;Data Source =E:\\\\logininf\\database\\login.mdb";
string myExecuteQuery = "insert into login(stuid,stuname,project,machine) values('" + TextBox1.Text + "','" + TextBox2.Text + "','" + TextBox3.Text + "','" + TextBox4.Text + "')";
OleDbConnection myConnection = new OleDbConnection(myConnectionString);
myConnection.Open();
OleDbCommand myCommand = new OleDbCommand(myExecuteQuery, myConnection);
myCommand.Connection.Open();
myCommand.ExecuteNonQuery();//返回影响的行数
myConnection.Close();
恳求高手给点指导,谢谢先!