求用C#窗体程序删除Access数据库中记录的代码。
2个回答
展开全部
using System.Data.OleDb;
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();
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();
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询