From: torka on 29 Mar 2010 00:28 Hi All, I've tried to insert some string to my access database using vbscript through SecureCRT. This is my current code: > > # $language = "VBScript" > # $interface = "1.0" > dim qstr > ' Create new instance of Microsoft Access. > Set objAccess = CreateObject("Access.Application") > > ' Open database in Microsoft Access window. > objAccess.OpenCurrentDatabase("E:\Rama_kerjaan\VBScrippt-Access\Code\coba.mdb") > > ' insert the data > qstr = "INSERT INTO gateway (Sortir) values('12')" > objAccess.DoCmd.RunSQL qstr > But the error came at: objAccess.DoCmd.RunSQL qstr The error message is "The RunSQL action was canceled" Does anyone knows my problem here? It would be very helpful. Thanks.... -- torka
From: torka on 29 Mar 2010 01:32 I have resolved this problem by using Execute command. > > # $language = "VBScript" > # $interface = "1.0" > dim qstr > ' Create new instance of Microsoft Access. > Set objAccess = CreateObject("Access.Application") > > ' Open database in Microsoft Access window. > objAccess.OpenCurrentDatabase("E:\Rama_kerjaan\VBScrippt-Access\Code\coba.mdb") > > ' insert the data > qstr = "(INSERT INTO gateway (Sortir) VALUES ('15'))" > objAccess.CurrentDb.Execute qstr > > objAccess.CurrentDb.close > objAccess.quit > -- torka
|
Pages: 1 Prev: play .wav file Next: Assigning local admin rights to remote users |