【求助】 大侠们快给挑错啊
static void Main(string[] args){
string str = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=Teacherdb.mdb";
OleDbConnection conn = new OleDbConnection(str);
conn.Open();
string sql = "Select * from teacher";
OleDbDataAdapter MyAdapter = new OleDbDataAdapter(sql, conn);
MyAdapter.SelectCommand = new OleDbCommand(sql,conn);
DataSet mydataset = new DataSet();
MyAdapter.Fill(mydataset,"teacher");
DataTable mytable=mydataset.Tables["teacher"];
DataRow myrow = mytable.NewRow();
//定义各行字段
myrow["ID"]="109";
myrow["Name"]="成龙";
myrow["Sex"]="男";
myrow["Nation"]="是";
myrow["Age"]="55";
myrow["Position"]="教授";
myrow["Master"]="是";
myrow["Tel"]="110";
mytable.Rows.Add(myrow);
MyAdapter.InsertCommand = new OleDbCommand("Insert into teacher (ID,Name,Sex,Nation,Age,Position,Master,Tel)"+
" Values ('" + myrow["ID"] + "','" +
myrow["Name"] + "','"+
myrow["Sex"] + "','"+
myrow["Nation"] + "','"+
myrow["Age"] + "','"+
myrow["Position"] + "','"+
myrow["Master"] + "',"+
myrow["Tel"] + ")",conn);
Console.WriteLine(MyAdapter.());
MyAdapter.Update(mydataset,"teacher");
Console.WriteLine("插入成功!");
Console.ReadLine();
}
}