Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

VBSCript writing to SQL database

Status
Not open for further replies.

SW2004

Technical User
Jul 13, 2004
24
GB
Can anyone help me with the following, when I try to write the PC name to a SQL database I get the message that column names are not permitted only variables, what's wrong with my code? I suspect it's the formatting of the (objComputer). Many thanks

'Read Machine Name
Set objComputer = CreateObject("Shell.LocalMachine")
SQLQuery = "insert into Audit_Table (MachineName) values(objComputer)"
objRSSQL.Open SQLQuery, objConn

Wscript.Echo "Done
 
SQLQuery = "insert into Audit_Table (MachineName) values('" & objComputer & "')"

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
Thanks PHV

I now receive the error 'object doesn't support this property or method', any ideas what could be amiss? I feel like I'm 99% there.

'Read Machine Name
Set objComputer = CreateObject("Shell.LocalMachine")
SQLQuery = "insert into Audit_Table (MachineName) values('" & objComputer & "')"
objRSSQL.Open SQLQuery, objConn
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top