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 derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Complete Blackout 4

Status
Not open for further replies.

durug

Technical User
Mar 22, 2002
335
CA
Hi everybody!

I ahve this code in my page:
<%
set objCmd=Server.CreateObject(&quot;ADODB.Command&quot;)
Set objCmd.ActiveConnection = &quot;Provider=SQLOLEDB;Server=SQL1;Database=pubs;UID=sa;PWD=&quot;
objCmd.CommandTimeout = 0
objCmd.CommandText=&quot;sp_doExtract&quot;
objCmd.CommandType=adCmdStoredProc
objCmd.Execute
%>
And I get the error:

Error Type:
Microsoft VBScript runtime (0x800A01A8)
Object required: 'ActiveConnection'
/b2b/dts.asp, line 3

What is going on? Or is something that I don't see?
Thanks in advance,
Durug
 
Try explicitly making your connection:

Set dbConn = Server.CreateObject(&quot;ADODB.Connection&quot;)
dbConn.ConnectionString = &quot;Provider=SQEDB;Server=SQL1;Database=pubs;UID=sa;PWD=&quot;
dbConn.Open

And then use that in your command:
set objCmd=Server.CreateObject(&quot;ADODB.Command&quot;)
Set objCmd.ActiveConnection = dbConn
objCmd.CommandTimeout = 0
objCmd.CommandText=&quot;sp_doExtract&quot;
objCmd.CommandType=adCmdStoredProc
objCmd.Execute

I usually use a DSN, so I don't know if the syntax is exactly right for the connection string, but give it a try and see what happens.
 
Try

<!-- #include &quot;adovbs.inc&quot;-->

Set myConn = Server.CreateObject(&quot;ADODB.Connection&quot;)
strConn = &quot;Provider=MyProvider;Server=SVR;Database=pubs;UID=sa;PWD=&quot;
myConn.Open strConn
Set rsObj = Server.CreateObject(&quot;ADODB.RecordSet&quot;)
rsObj.ActiveConnection = myConn

...


HTH


William
Software Engineer
 
Thank you guys. I took some info from both of you:
1. I created the Connection Object

Set dbConn = Server.CreateObject(&quot;ADODB.Connection&quot;)
dbConn.ConnectionString = &quot;Provider=SQEDB;Server=SQL1;Database=pubs;UID=sa;PWD=&quot;
dbConn.Open

2. and then I got another error: for which I changed the line
objCmd.CommandType=adCmdStoredProc
to
objCmd.CommandType=4
cause I didn't include the adovbs.inc

Now its working!
 
Why can I not award this thread with a star??? I don't see the option anymore!!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top