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