Error while Executing Update query to update Access DB table using UFT

511 views Asked by At

I am trying to execute an update query in UFT that connects to Access DB, but an error "Operation must use an updateable query" is thrown. Need solution.

code used:

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
0

There are 0 answers