Adodc1.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=D:\SQL\管理.mdb;Persist Security Info=False"
Adodc1.CommandType = adCmdTable
Adodc1.RecordSource = "总库"
Adodc1.Refresh
Adodc1.RecordSource = "insert into 总库 values('a33','小张',18,'6363826')"
Adodc1.CommandType =adCmdText
Adodc1.Refresh
能出现"对象关闭时,操作不被允许"  系统提示是Adodc1.Refresh有问题!
应该怎么改?谢谢各位大虾指点!!!

解决方案 »

  1.   

    调换顺序,应该先设置为SQL语句执行方式,然后再INSERT
    Adodc1.CommandType =adCmdText
    Adodc1.RecordSource = "insert into 总库 values('a33','小张',18,'6363826')"
      

  2.   

    Adodc1.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=D:\SQL\管理.mdb;Persist Security Info=False"
    Adodc1.CommandType = adCmdText
    Adodc1.RecordSource = "select * from 总库"
    Adodc1.Recordset.Close
    Adodc1.Recordset.Open "insert into 总库 values('a33','小张',18,'6363826')"
    Adodc1.Refresh