Re: Connecting to Object that returns database connection
Re: Connecting to Object that returns database connection
am 18.04.2008 21:48:02 von Venkatesan S
Hi,
I am facing a different issue with the same scenario.
My component returns a Connection objec to ASP page and then I am trying to
use the same Connection object to Command/Recordset object to execute a SP
I am getting the error given below
************************************
ADODB.Recordset error '800a0bb9'
Arguments are of the wrong type, are out of acceptable range, or are in
conflict with one another.
=====================================
Source code :
Option 1:
rs1.Open "MentorTest",objConnection.GetConnection,2,4,4
Option 2:
Dim sqlConnection
Set sqlConnection = objConnection.GetConnection
rs1.Open "MentorTest",sqlConnection,2,4,4
Option 3:
Dim sqlConnection
Set sqlConnection = Server.CreateObject("ADODB.Connection")
Set sqlConnection = objConnection.GetConnection
rs1.Open "MentorTest",sqlConnection,2,4,4
************************************
I ensured object creation by IsObject method, connection state of the
sqlConnection
Could you please tell what could be the issue. Your pointers will be
appreciated.
"Bob Barrows [MVP]" wrote:
> Errr... that was the first suggestion he received ... two weeks ago. I
> would imagine his problem is resolved by now.
>
> B@DJJ wrote:
> > How about simply adding SET to your stmt(s) (so that they get created
> > as objects):
> >
> > SET mytest = Server.CreateObject("mydll.database")
> > ....
> > SET myConnection = mytest.getConnection
> >
> > "T McDonald" wrote:
> >
> >> I'm having some issues with a dll I've created to return an
> >> ADOConnection back to an ASP script.
> >>
> >> I successfully open my object:
> >> mytest = Server.CreateObject("mydll.database")
> >> I then attempt to use the connection:
> >> myConnection = mytest.getConnection
> >>
> >> This is where the script breaks down with an "Object required" error.
> >>
> >> I am able to access other methods in the dll, it just doesn't seem
> >> to be returning the database connnection successfully.
> >>
> >> Any help is greatly appreciated.
>
> --
> Microsoft MVP -- ASP/ASP.NET
> Please reply to the newsgroup. The email account listed in my From
> header is my spam trap, so I don't check it very often. You will get a
> quicker response by posting to the newsgroup.
>
>
>
Re: Connecting to Object that returns database connection
am 18.04.2008 22:08:36 von reb01501
Venkatesan S wrote:
> Hi,
> I am facing a different issue with the same scenario.
>
> My component returns a Connection objec to ASP page and then I am
> trying to use the same Connection object to Command/Recordset object
> to execute a SP
>
> I am getting the error given below
> ************************************
> ADODB.Recordset error '800a0bb9'
>
> Arguments are of the wrong type, are out of acceptable range, or are
> in conflict with one another.
>
> =====================================
> Source code :
> Option 1:
> rs1.Open "MentorTest",objConnection.GetConnection,2,4,4
>
> Option 2:
>
> Dim sqlConnection
> Set sqlConnection = objConnection.GetConnection
> rs1.Open "MentorTest",sqlConnection,2,4,4
>
> Option 3:
> Dim sqlConnection
> Set sqlConnection = Server.CreateObject("ADODB.Connection")
> Set sqlConnection = objConnection.GetConnection
> rs1.Open "MentorTest",sqlConnection,2,4,4
>
> ************************************
> I ensured object creation by IsObject method, connection state of the
> sqlConnection
>
So that seems to indicate that you are misplacing the blame here. To
prove it, try a simple
set rs1 = createobject("adodb.recordset")
sqlConnection.MentorTest, rs1
I believe a dynamic cursor (2) is incompatible with a lock type of
adLockBatchOptimistic (4), which may be causing your error.
--
Microsoft MVP -- ASP/ASP.NET
Please reply to the newsgroup. The email account listed in my From
header is my spam trap, so I don't check it very often. You will get a
quicker response by posting to the newsgroup.
Re: Connecting to Object that returns database connection
am 21.04.2008 19:38:05 von VenkatesanS
Hi,
Still I am getting the same error. But for the same parameters(2,4) If I
provide the connection string instead of a conneciton object it is working
fine. As suggested by you I have tried with different parameter value also
(0-adOpenForwardOnly, 3-adLockOptimistic).
I have tried another approach also with SQL Command Execute Method. Here
also I am getting error but the error is different(below one)
****************************************
Connection is a Object
Microsoft VBScript runtime error '800a000d'
Type mismatch: 'ActiveConnection'
****************************************
The error is occuring when assigning a connection object to the
activeconnection property of SQLCommand and Recordset.
The code of using command object is given below
Set SQLCommand.ActiveConnection = sqlConnection
SQLCommand.CommandText="MentorTest"
SQLCommand.CommandType=1
'Creates a read-only, forward only recordset
Set rs = SQLCommand.Execute
Thanks & Regards
Venkatesan S
"Bob Barrows [MVP]" wrote:
> Venkatesan S wrote:
> > Hi,
> > I am facing a different issue with the same scenario.
> >
> > My component returns a Connection objec to ASP page and then I am
> > trying to use the same Connection object to Command/Recordset object
> > to execute a SP
> >
> > I am getting the error given below
> > ************************************
> > ADODB.Recordset error '800a0bb9'
> >
> > Arguments are of the wrong type, are out of acceptable range, or are
> > in conflict with one another.
> >
> > =====================================
> > Source code :
> > Option 1:
> > rs1.Open "MentorTest",objConnection.GetConnection,2,4,4
> >
> > Option 2:
> >
> > Dim sqlConnection
> > Set sqlConnection = objConnection.GetConnection
> > rs1.Open "MentorTest",sqlConnection,2,4,4
> >
> > Option 3:
> > Dim sqlConnection
> > Set sqlConnection = Server.CreateObject("ADODB.Connection")
> > Set sqlConnection = objConnection.GetConnection
> > rs1.Open "MentorTest",sqlConnection,2,4,4
> >
> > ************************************
> > I ensured object creation by IsObject method, connection state of the
> > sqlConnection
> >
>
> So that seems to indicate that you are misplacing the blame here. To
> prove it, try a simple
>
> set rs1 = createobject("adodb.recordset")
> sqlConnection.MentorTest, rs1
>
> I believe a dynamic cursor (2) is incompatible with a lock type of
> adLockBatchOptimistic (4), which may be causing your error.
>
> --
> Microsoft MVP -- ASP/ASP.NET
> Please reply to the newsgroup. The email account listed in my From
> header is my spam trap, so I don't check it very often. You will get a
> quicker response by posting to the newsgroup.
>
>
>
Re: Connecting to Object that returns database connection
am 21.04.2008 19:45:49 von reb01501
Venkatesan S wrote:
> Hi,
> Still I am getting the same error. But for the same parameters(2,4)
> If I provide the connection string instead of a conneciton object it
> is working fine. As suggested by you I have tried with different
> parameter value also (0-adOpenForwardOnly, 3-adLockOptimistic).
>
> I have tried another approach also with SQL Command Execute Method.
> Here also I am getting error but the error is different(below one)
>
> ****************************************
> Connection is a Object
> Microsoft VBScript runtime error '800a000d'
>
> Type mismatch: 'ActiveConnection'
> ****************************************
>
>
>
> The error is occuring when assigning a connection object to the
> activeconnection property of SQLCommand and Recordset.
>
> The code of using command object is given below
>
> Set SQLCommand.ActiveConnection = sqlConnection
> SQLCommand.CommandText="MentorTest"
> SQLCommand.CommandType=1
> 'Creates a read-only, forward only recordset
> Set rs = SQLCommand.Execute
>
>
Well, the type mismatch does seem to indicate that you are not getting
an adodb connection from your component. In your initial post, you said
you had verified the object type and state - had you done that in the
consuming vbscript code or in the component?
Frankly, I don't think we're going to have much success getting to the
bottom of this from our vantage point. My earlier point about passing
connection strings instead of objects from components still stands.
--
Microsoft MVP -- ASP/ASP.NET
Please reply to the newsgroup. The email account listed in my From
header is my spam trap, so I don't check it very often. You will get a
quicker response by posting to the newsgroup.
Re: Connecting to Object that returns database connection
am 21.04.2008 23:03:59 von VenkatesanS
Thanks Bob.
The reason for the problem is
"ADO connection objetcs cannot be marshalled across
apartments/processes/host "
So I am stopping my analysis on this with this....
Thanks & Regards
Venkatesan S
"Bob Barrows [MVP]" wrote:
> Venkatesan S wrote:
> > Hi,
> > Still I am getting the same error. But for the same parameters(2,4)
> > If I provide the connection string instead of a conneciton object it
> > is working fine. As suggested by you I have tried with different
> > parameter value also (0-adOpenForwardOnly, 3-adLockOptimistic).
> >
> > I have tried another approach also with SQL Command Execute Method.
> > Here also I am getting error but the error is different(below one)
> >
> > ****************************************
> > Connection is a Object
> > Microsoft VBScript runtime error '800a000d'
> >
> > Type mismatch: 'ActiveConnection'
> > ****************************************
> >
> >
> >
> > The error is occuring when assigning a connection object to the
> > activeconnection property of SQLCommand and Recordset.
> >
> > The code of using command object is given below
> >
> > Set SQLCommand.ActiveConnection = sqlConnection
> > SQLCommand.CommandText="MentorTest"
> > SQLCommand.CommandType=1
> > 'Creates a read-only, forward only recordset
> > Set rs = SQLCommand.Execute
> >
> >
>
> Well, the type mismatch does seem to indicate that you are not getting
> an adodb connection from your component. In your initial post, you said
> you had verified the object type and state - had you done that in the
> consuming vbscript code or in the component?
> Frankly, I don't think we're going to have much success getting to the
> bottom of this from our vantage point. My earlier point about passing
> connection strings instead of objects from components still stands.
>
> --
> Microsoft MVP -- ASP/ASP.NET
> Please reply to the newsgroup. The email account listed in my From
> header is my spam trap, so I don't check it very often. You will get a
> quicker response by posting to the newsgroup.
>
>
>