Yasser Shohoud [MS]
1/24/2003 10:53:00 PM
Hi Vicky,
I'm a little confused by your post because from looking at the code I would
suspect that you would hit the error on the second to last line. I think
the problem is that you are trying to use the ActiveConnection (calling
Open) when it is null. null is the default value for ActiveConnection and
in the code example below you don't set it to anything else before using it.
The code from the original post looked a little different and I think it was
probably correct. An abbreviated example of what I think you want is
something like...
' Omitted declarations
oCmd = Server.CreateObject("ADODB.Command")
oCmd.ActiveConnection = conn
' Do something with the command.
You can assign the connection string directly to the ActiveConnection. I
think this is what the code from your original post did.
Hope that helps.
Michael Clark
Microsoft
--
Please do not send email directly to this alias. This alias is for newsgroup
purposes only.
This posting is provided "AS IS" with no warranties, and confers no rights.
"Vicky S" <sabretooth21@comcast.net> wrote in message
news:emo1$38wCHA.1620@TK2MSFTNGP11...
> Maybe this will clarify the problem a bit. my code looks like this..
> Dim oCmd As ADODB.Command, oRs As ADODB.Recordset
> conn = "Provider=SQLOLEDB;DataSource=JADE;Initial Catalog=temp;Network
> Address=JADE;User Id=sa;Password=;"
>
> oCmd = Server.CreateObject("ADODB.Command")
>
> oCmd.ActiveConnection.Open()
>
> oCmd.ActiveConnection.ConnectionString = conn
>
> the error I get is on the last line above and it says "Object reference
not
> set to an instance of an object"
>
> "Vicky S" <sabretooth21@comcast.net> wrote in message
> news:uWiATnxwCHA.2600@TK2MSFTNGP11...
> >
> > Hey all,
> > This works on a regular asp page :
> > set oCmd = server.CreateObject("ADODB.Command")
> > oCmd.ActiveConnection = sql_connection
> >
> > But it doesn't on my asp.net webservice... does anyone know what the
> correct
> > syntax is and why it won't accept this?
> >
> > Thanks,
> > V
> >
> >
>
>