求C#窗体程序用textBox控件中的数据更新Access数据库表中的数据的代码。
1个回答
展开全部
string dbpath = AppDomain.CurrentDomain.BaseDirectory + "\\data\\database1.mdb";
OleDbConnection con = new OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0; Data Source=" + dbpath);
string sql = "delete from 表 where id=1";
OleDbCommand cmd = new OleDbCommand(sql, con);
con.Open();
cmd.ExecuteNonQuery();
con.Close();
OleDbConnection con = new OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0; Data Source=" + dbpath);
string sql = "delete from 表 where id=1";
OleDbCommand cmd = new OleDbCommand(sql, con);
con.Open();
cmd.ExecuteNonQuery();
con.Close();
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询