PDA

View Full Version : ASP page to VBS script


arielex
12-27-2002, 03:25 PM
Hi

I usually make a connection to a MSSQL database using these lines (ASP script):

set conn = Server.Createobject("ADODB.Connection")
conn.open "sdb", "sa", ""

now, i try these same lines in a .vbs script, which i run with cscript.exe. I get the error:

Object required: 'Server'


anyone???

tnx

Arie

BigDaddy
12-27-2002, 11:20 PM
If you're running it on your local machine, then don't use "server."

Just leave it as:

set conn = Createobject("ADODB.Connection")
conn.open "sdb", "sa", ""

whammy
12-28-2002, 12:29 AM
Yup... BigDaddy nailed it again... use CreateObject() instead of Server.CreateObject() since you're just using a VBScript file, they are local to your machine when run.

If that doesn't work, make sure you go into Settings/Control Panel/ODBC Sources (this path might differ depending upon your operating system), and ensure that you have access to the SQL database.

arielex
12-28-2002, 02:25 AM
thanx! I'll try that!