Wednesday, May 18, 2016

VBScript to update Access Database


Save following line to .VBS file


Const adOpenStatic = 3
Const adLockOptimistic = 3

Set objConnection = CreateObject("ADODB.Connection")
Set objRecordSet = CreateObject("ADODB.Recordset")

objConnection.Open _
    "Provider = Microsoft.Jet.OLEDB.4.0;; Data Source = C:\Temp\Local.mdb"

objRecordSet.Open "Update Set = ", _
        objConnection, adOpenStatic, adLockOptimistic

OR

objRecordSet.Open "Insert into Values(,,...)", _
        objConnection, adOpenStatic, adLockOptimistic




Execute script Via Command Line

  1. Hold your windows key and press “R” to open the command prompt
  2. type: “%windir%\SysWoW64\wscript.exe
  3. Press OK

No comments:

Post a Comment

Your feedback is always appreciated. I will try to reply to your queries as soon as time allows.Please don't spam,spam comments will be deleted upon reviews.