对ACESS数据库操作时,删除完数据库后应对其数据库进行压缩,否则数据库容量会逐渐变大!!!!
private void button4_Click(object sender, System.EventArgs e)
{
OleDbConnection myConn = new OleDbConnection ( strCon ) ;
System.Data.OleDb.OleDbCommand myCommand =new OleDbCommand();
myCommand.Connection=myConn;
myConn.Open();
try
{
myCommand.CommandText="delete from gjb";
myCommand.ExecuteNonQuery();
//myCommand.CommandText="alter table gjb alter id counter(1,1)";//有了压缩数据库后,就不需要此句执行
//myCommand.ExecuteNonQuery();
myCommand.CommandText="delete from hz";
myCommand.ExecuteNonQuery();
//myCommand.CommandText="alter table hz alter id counter(1,1)";//有了压缩数据库后,就不需要此句执行
//myCommand.ExecuteNonQuery();
this.button1.Enabled=true;
this.button4.Enabled