在Excel中执行SQL更新语句

时间:2019-07-09 14:56:10

标签: excel vba

我正在尝试执行此代码,但出现错误:“此操作需要可更新的查询。”

有人可以帮我吗?

Dim con As ADODB.Connection
Dim rs As ADODB.Recordset

Set con = New ADODB.Connection

con.Open "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" & ThisWorkbook.FullName & ";Extended Properties=""Excel 12.0 xml;HDR=YES;IMEX=1;Readonly=False"";"

Set rs = New ADODB.Recordset
Set rs = con.Execute("UPDATE [Tipo record 010$] SET tipo_record = 'NICK' WHERE numero_operazione = '999189944458'")

Set rs = Nothing
Set con = Nothing

该操作需要可更新的查询

0 个答案:

没有答案