conn.Open();
OleDbDataAdapter adapter = new OleDbDataAdapter();
String dbstr = @"SELECT * FROM ";
adapter.SelectCommand = new OleDbCommand(dbstr + TableName,conn);//必须要有SelectCommand命令
OleDbCommandBuilder custCB = new OleDbCommandBuilder(adapter);//自动生成命令
DataTable datatable = new DataTable();
string dbstrDel = @"DELETE * From " + TableName + " WHERE Id = " + o.ToString();
adapter.DeleteCommand = new OleDbCommand(dbstrDel,conn);
adapter.DeleteCommand.ExecuteNonQuery();
adapter.Update(datatable);
conn.Close();
OleDbDataAdapter adapter = new OleDbDataAdapter();
String dbstr = @"SELECT * FROM ";
adapter.SelectCommand = new OleDbCommand(dbstr + TableName,conn);//必须要有SelectCommand命令
OleDbCommandBuilder custCB = new OleDbCommandBuilder(adapter);//自动生成命令
DataTable datatable = new DataTable();
string dbstrDel = @"DELETE * From " + TableName + " WHERE Id = " + o.ToString();
adapter.DeleteCommand = new OleDbCommand(dbstrDel,conn);
adapter.DeleteCommand.ExecuteNonQuery();
adapter.Update(datatable);
conn.Close();