使用ADODB

时间:2017-02-14 21:40:46

标签: sql sql-server excel vba

说我在Excel中有一张表:
表A:
ID,
名称,
工作,
DOB
我有一个插入查询,如:

Insert into TableA(ID,Name,Work,DOB) values (....);    

我创建了使用ADODB将此数据上传到SQL Server数据库的代码 上传工作正常,但我试图让它填充每行旁边的上传状态(待定,成功)。有什么办法吗?
我的代码的结尾部分是:

For lp = 0 To qryindex - 1 'this loop is used to get query from the array which is stored in previous loop  
con.Open 'open the connection  
con.Execute qryary(lp), dbfailonerror ' execute the query one by one according to index value  
oldValue = Application.ActiveCell.Value  
con.Close

Next lp  
MsgBox "Data Updated Successfully"  
ThisWorkbook.RefreshAll  

我需要它来更新coulmn(F),因为数组中的每个查询都已成功发布

0 个答案:

没有答案