troubleshooting Question

VBScript write to ODBC database on remote machine

Avatar of churchlandsshs
churchlandsshsFlag for Australia asked on
DatabasesMicrosoft Development
3 Comments1 Solution3072 ViewsLast Modified:
Using VBScript I need to write data to an Access database on a remote machine.

At the moment, I have the script below, which works perfectly, but requires me to manually set up the ODBC first.

What is the best way to automate being able to write to the remote database?

500 points, because it is fairly urgent.
Const adOpenStatic = 3
Const adLockOptimistic = 3
Const adUseClient = 3
Set objConnection = CreateObject("ADODB.Connection")
Set objRecordset = CreateObject("ADODB.Recordset")
 
objConnection.Open "DSN=Test;"
objRecordset.CursorLocation = adUseClient
 
strIPaddr = "10.0.0.1"
strComputerName = "test"
strSerialNumber = "90556"
strLocation = "administration"
strYear = "2009"
strInformation = "This is a test to see if the script works"
 
objRecordset.Open "SELECT * FROM Computers" , objConnection, adOpenStatic, adLockOptimistic
 
   objRecordset.AddNew
 
    objRecordset("ComputerName") = strComputerName
    objRecordset("YearAcquired") = strYear
    objRecordset("Location") = strLocation
    objRecordset("Information") = strInformation
    objRecordset("SerialNumber") = strSerialNumber
 
    objRecordset.Update
 
objRecordset.Close
objConnection.Close
Join the community to see this answer!
Join our exclusive community to see this answer & millions of others.
Unlock 1 Answer and 3 Comments.
Join the Community
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 3 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros