VB 对象关闭时不允许操作。如何实现删除数据库某些行,VB当中
按钮一、查询这些数据---------->>>>>>这是OK的,没有报错PrivateSubCommand1_Click()shujuku="UFDATA"&"_"&zh...
按钮一、查询这些数据 ---------->>>>>> 这是OK的,没有报错
Private Sub Command1_Click()
shujuku = "UFDATA" & "_" & zhangtaohao & "_" & niandu
lianjiechuan = "Provider=SQLOLEDB.1;Password=usine;Persist Security Info=True;User ID=sa;Initial Catalog=" & shujuku & ";Data Source=pc3000"
Adodc1.ConnectionString = lianjiechuan
Adodc1.RecordSource = "select * from hr_hi_person"
Adodc1.Refresh
Set DataGrid1.DataSource = Adodc1
DataGrid1.Refresh
End Sub
按钮二、删除数据表中的错误 --------------------->报 "VB 对象关闭时不允许操作"的错误
Private Sub Command2_Click()
shujuku = "UFDATA" & "_" & zhangtaohao & "_" & niandu
lianjiechuan = "Provider=SQLOLEDB.1;Password=usine;Persist Security Info=True;User ID=sa;Initial Catalog=" & shujuku & ";Data Source=pc3000"
Adodc1.ConnectionString = lianjiechuan
Adodc1.RecordSource = "delete hr_hi_person"
Adodc1.Refresh '如果不添加这句,不报错,但是不能删除数据库
End Sub 展开
Private Sub Command1_Click()
shujuku = "UFDATA" & "_" & zhangtaohao & "_" & niandu
lianjiechuan = "Provider=SQLOLEDB.1;Password=usine;Persist Security Info=True;User ID=sa;Initial Catalog=" & shujuku & ";Data Source=pc3000"
Adodc1.ConnectionString = lianjiechuan
Adodc1.RecordSource = "select * from hr_hi_person"
Adodc1.Refresh
Set DataGrid1.DataSource = Adodc1
DataGrid1.Refresh
End Sub
按钮二、删除数据表中的错误 --------------------->报 "VB 对象关闭时不允许操作"的错误
Private Sub Command2_Click()
shujuku = "UFDATA" & "_" & zhangtaohao & "_" & niandu
lianjiechuan = "Provider=SQLOLEDB.1;Password=usine;Persist Security Info=True;User ID=sa;Initial Catalog=" & shujuku & ";Data Source=pc3000"
Adodc1.ConnectionString = lianjiechuan
Adodc1.RecordSource = "delete hr_hi_person"
Adodc1.Refresh '如果不添加这句,不报错,但是不能删除数据库
End Sub 展开
3个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询