1

我正在尝试在连接到 Access DB 的 UFT 中执行更新查询,但会引发错误“操作必须使用可更新查询”。需要解决方案。

使用的代码:

Dim fld

Dim newConn

Dim newCommand

set newConn = createObject("ADODB.CONNECTION")
Set newCommand=createObject("ADODB.command")

newConn.ConnectionString = "Provider=Microsoft.ACE.OLEDB.12.0;Password="""";User ID=Admin;Data Source=H:\Desktop\P&P\AdvancedExcel\Chess Players.accdb;Mode=Share Deny Write;Extended Properties="""";Jet OLEDB:System database="""";Jet OLEDB:Registry Path="""";Jet OLEDB:Database Password="""";Jet OLEDB:Engine Type=6;Jet OLEDB:Database Locking Mode=0;Jet OLEDB:Global Partial Bulk Ops=2;Jet OLEDB:Global Bulk Transactions=1;Jet OLEDB:New Database Password="""";Jet OLEDB:Create System Database=False;Jet OLEDB:Encrypt Database=False;Jet OLEDB:Don't Copy Locale on Compact=False;Jet OLEDB:Compact Without Replica Repair=False;Jet OLEDB:SFP=False;Jet OLEDB:Support Complex Data=False;Jet OLEDB:Bypass UserInfo Validation=False"

newConn.Open

newCommand.ActiveConnection=newConn

newCommand.CommandText= "Insert into Chessplayerswithratings values (""21"",""2001"",""1500"",""Kishore Palli"") "

newCommand.Execute

'newCommand.Execute "Update ChessPlayersWithRatings set Rank=2001 where Player = ""Magnus Carlsen""  "

newCommand.close

newConn.Close

Set newConn=nothing

Set newRecset=nothing
4

0 回答 0