新手求大神指导,我往数据库增加记录时候提示的!数据库是Access
private void button1_Click(object sender, EventArgs e){
string Con = "provider=MIcrosoft.ACE.OLEDB.12.0;" + @"Data source=D:\c\DataBase\student.accdb";//第二个参数为文件的路径
OleDbConnection conn = new OleDbConnection(Con);
conn.Open();//建立连接
string no = "'" + textBox1.Text + "'", name = "'" + textBox2.Text + "'",a= "'" + textBox3.Text + "'",
tal = "'" + textBox4.Text + "'",gen = "'" + comboBox1.Text + "'";
string insert = "INSERT INTO student(studentno,studentname,age,tall,gender)values(n,name,a,tal,gen)";
OleDbCommand mycommand = new OleDbCommand(insert, conn);
mycommand.ExecuteNonQuery(); //这里提示至少有一个值没有指定值,请问是哪里的问题!
OleDbDataAdapter inst = new OleDbDataAdapter("SELECT * FROM student", conn);//选择全部内容
DataSet ds = new DataSet();//临时存储
inst.Fill(ds);//用inst填充ds
dataGridView1.DataSource = ds.Tables[0];//展示ds第一张表到dataGridView1控件
conn.Close();
}