|
 |
asp_databases thread: does Command Object have and Errors collection?
Message #1 by "Ron Williams" <ronwilliams32@c...> on Mon, 11 Nov 2002 23:17:18
|
|
This question is related to using ADO and ASP with VBScript.
I know there is an 'Errors Collection' for the 'ADO connection object',
but is there an equivalent errors collection for the 'command object'? If
so, how do I access the properties of the command object's errors
collection?
Thanks,
Ron
Message #2 by "Ken Schaefer" <ken@a...> on Tue, 12 Nov 2002 15:27:20 +1100
|
|
The command object needs a connection. Check the connection object for
errors after executing the command object.
Cheers
Ken
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
From: "Ron Williams" <ronwilliams32@c...>
Subject: [asp_databases] does Command Object have and Errors collection?
: This question is related to using ADO and ASP with VBScript.
:
: I know there is an 'Errors Collection' for the 'ADO connection object',
: but is there an equivalent errors collection for the 'command object'? If
: so, how do I access the properties of the command object's errors
: collection?
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Message #3 by "Ron Williams" <ronwilliams32@c...> on Tue, 12 Nov 2002 13:18:10
|
|
Yes, but i use...
set objComm = server.createobject("adodb.command")
objComm.ActiveConnection = MyConnection
... instead of the connection object. Are you saying i can access a the
errors collection some how when i use this method? I guess my question
is, how do i do that? I have not been able to find a way and if i switch
back to creating connections with the connection object, ill have to
change several lines of code because i set up connections as i did above
throughout the entire program.
Thanks,
Ron
> The command object needs a connection. Check the connection object for
errors after executing the command object.
Cheers
Ken
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
From: "Ron Williams" <ronwilliams32@c...>
Subject: [asp_databases] does Command Object have and Errors collection?
: This question is related to using ADO and ASP with VBScript.
:
: I know there is an 'Errors Collection' for the 'ADO connection object',
: but is there an equivalent errors collection for the 'command object'?
If
: so, how do I access the properties of the command object's errors
: collection?
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Message #4 by "Ron Williams" <ronwilliams32@c...> on Tue, 12 Nov 2002 13:21:04
|
|
Oh, by the way, I use the Command object instead of connection and
recordset objects because i believe i get better performance when using
ASP with Access over a network(this is for an intranet app). If that is
just my imagination, please straighten me out and ill just change the code
to use the connection objects.
Thanks,
Ron
> The command object needs a connection. Check the connection object for
errors after executing the command object.
Cheers
Ken
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
From: "Ron Williams" <ronwilliams32@c...>
Subject: [asp_databases] does Command Object have and Errors collection?
: This question is related to using ADO and ASP with VBScript.
:
: I know there is an 'Errors Collection' for the 'ADO connection object',
: but is there an equivalent errors collection for the 'command object'?
If
: so, how do I access the properties of the command object's errors
: collection?
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Message #5 by "Ken Schaefer" <ken@a...> on Wed, 13 Nov 2002 13:22:03 +1100
|
|
What is "myConnection"? Isn't that a connection object? (maybe a more useful
naming scheme might help? strSQLServerConnString, objSQLServerConn?)
Is it a connection string? If so, change it to a connection object. If you
pass in a connection string you are losing all the benefits of connection
pooling. ADO *is creating* a connection object for you (implicitly) behind
the scenes. However you have no reference to it, and you can't return it to
the connection pool (by doing objConn.Close)
http://support.microsoft.com/default.aspx?scid=kb;EN-US;191572
INFO: Connection Pool Management by ADO Objects Called From ASP
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnmdac/html
/pooling2.asp
Pooling in the Microsoft Data Access Components
Cheers
Ken
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
From: "Ron Williams" <ronwilliams32@c...>
Subject: [asp_databases] Re: does Command Object have and Errors collection?
: Yes, but i use...
:
: set objComm = server.createobject("adodb.command")
: objComm.ActiveConnection = MyConnection
:
: ... instead of the connection object. Are you saying i can access a the
: errors collection some how when i use this method? I guess my question
: is, how do i do that? I have not been able to find a way and if i switch
: back to creating connections with the connection object, ill have to
: change several lines of code because i set up connections as i did above
: throughout the entire program.
:
: Thanks,
:
: Ron
:
: > The command object needs a connection. Check the connection object for
: errors after executing the command object.
:
: Cheers
: Ken
:
: ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
: From: "Ron Williams" <ronwilliams32@c...>
: Subject: [asp_databases] does Command Object have and Errors collection?
:
:
: : This question is related to using ADO and ASP with VBScript.
: :
: : I know there is an 'Errors Collection' for the 'ADO connection object',
: : but is there an equivalent errors collection for the 'command object'?
: If
: : so, how do I access the properties of the command object's errors
: : collection?
:
: ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Message #6 by "Ron Williams" <ronwilliams32@c...> on Thu, 14 Nov 2002 01:09:48
|
|
Ken, the pooling is N/A in this case because as i stated, i am using MS
Access(JET OLE DB) and the documentation states...
"Connections that use the Jet OLE DB providers and ODBC drivers are not
pooled because those providers and drivers do not support pooling."
to answer YOUR question, "myconnection" or "strSQLServerConnString",
whatever you want to call it, it is the value of the ActiveConnection
property of the Command object. As i stated in my original question, i
did not use the connection object. ADO does create a connection to the
database when you assign a value (connection string) to the
ActiveConnection property, but it does not create a connection object the
same way you can create a recordset object by executing a select query
with a command object and using the SET keyword.
my question is, does the Command object have an errors collection similar
to the one that is available with the connection object and if so, how do
i access it?
thanks,
ron
> What is "myConnection"? Isn't that a connection object? (maybe a more
useful
naming scheme might help? strSQLServerConnString, objSQLServerConn?)
Is it a connection string? If so, change it to a connection object. If you
pass in a connection string you are losing all the benefits of connection
pooling. ADO *is creating* a connection object for you (implicitly) behind
the scenes. However you have no reference to it, and you can't return it to
the connection pool (by doing objConn.Close)
http://support.microsoft.com/default.aspx?scid=kb;EN-US;191572
INFO: Connection Pool Management by ADO Objects Called From ASP
http://msdn.microsoft.com/library/default.asp?url=/library/en-
us/dnmdac/html
/pooling2.asp
Pooling in the Microsoft Data Access Components
Cheers
Ken
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
From: "Ron Williams" <ronwilliams32@c...>
Subject: [asp_databases] Re: does Command Object have and Errors
collection?
: Yes, but i use...
:
: set objComm = server.createobject("adodb.command")
: objComm.ActiveConnection = MyConnection
:
: ... instead of the connection object. Are you saying i can access a the
: errors collection some how when i use this method? I guess my question
: is, how do i do that? I have not been able to find a way and if i switch
: back to creating connections with the connection object, ill have to
: change several lines of code because i set up connections as i did above
: throughout the entire program.
:
: Thanks,
:
: Ron
:
: > The command object needs a connection. Check the connection object for
: errors after executing the command object.
:
: Cheers
: Ken
:
: ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
: From: "Ron Williams" <ronwilliams32@c...>
: Subject: [asp_databases] does Command Object have and Errors collection?
:
:
: : This question is related to using ADO and ASP with VBScript.
: :
: : I know there is an 'Errors Collection' for the 'ADO connection object',
: : but is there an equivalent errors collection for the 'command object'?
: If
: : so, how do I access the properties of the command object's errors
: : collection?
:
: ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Message #7 by "Ken Schaefer" <ken@a...> on Thu, 14 Nov 2002 13:35:56 +1100
|
|
Ron,
I will try to rephrase what I've said.
My question was: What is "myConnection"? It is unclear whether this is a
*string* or an *object*. From your answer below I gather that it is a
string. Because you are passing in a connection *string*, ADO is creating a
connection object (implicitly) for you. This connection object will have an
Errors collection BUT you can't access it because you have no reference to
it (well, you might via objCommand.ActiveConnection)
What you need to do is:
<%
Set objConn = Server.CreateObject("ADODB.Connection")
objConn.Open(myConnection)
Set objCommand = Server.CreateObject("ADODB.Command")
Set objCommand.ActiveConnection = objConn
' Now errors will still be placed into the connection object
' and you now have a reference to the connection object (objConn)
' so you can get the errors!
%>
*even* if the connection wasn't pooled, you have no reference to the
connection so you can't close it. Instead, you have to wait for the
connection to timeout. Better would be to explicitly open a connection, then
close it as soon as possible, thus increasing the scalability of your app.
In answer to your specific query about whether the command object has an
Errors collection, the answer is "no". Here is a list of all ADO
collections:
http://msdn.microsoft.com/library/?url=/library/en-us/ado270/htm/mdmscadocol
lections.asp?frame=true
Here is the Errors collection:
http://msdn.microsoft.com/library/?url=/library/en-us/ado270/htm/mdmscadocol
lections.asp?frame=true
Here are all the properties of the command object (note, there is no
property that exposes a collection of errors):
http://msdn.microsoft.com/library/?url=/library/en-us/ado270/htm/mdmscadocol
lections.asp?frame=true
Cheers
Ken
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
From: "Ron Williams" <ronwilliams32@c...>
Subject: [asp_databases] Re: does Command Object have and Errors collection?
: Ken, the pooling is N/A in this case because as i stated, i am using MS
: Access(JET OLE DB) and the documentation states...
:
: "Connections that use the Jet OLE DB providers and ODBC drivers are not
: pooled because those providers and drivers do not support pooling."
:
:
: to answer YOUR question, "myconnection" or "strSQLServerConnString",
: whatever you want to call it, it is the value of the ActiveConnection
: property of the Command object. As i stated in my original question, i
: did not use the connection object. ADO does create a connection to the
: database when you assign a value (connection string) to the
: ActiveConnection property, but it does not create a connection object the
: same way you can create a recordset object by executing a select query
: with a command object and using the SET keyword.
:
: my question is, does the Command object have an errors collection similar
: to the one that is available with the connection object and if so, how do
: i access it?
:
: thanks,
:
: ron
:
: > What is "myConnection"? Isn't that a connection object? (maybe a more
: useful
: naming scheme might help? strSQLServerConnString, objSQLServerConn?)
:
: Is it a connection string? If so, change it to a connection object. If you
: pass in a connection string you are losing all the benefits of connection
: pooling. ADO *is creating* a connection object for you (implicitly) behind
: the scenes. However you have no reference to it, and you can't return it
to
: the connection pool (by doing objConn.Close)
:
: http://support.microsoft.com/default.aspx?scid=kb;EN-US;191572
: INFO: Connection Pool Management by ADO Objects Called From ASP
:
: http://msdn.microsoft.com/library/default.asp?url=/library/en-
: us/dnmdac/html
: /pooling2.asp
: Pooling in the Microsoft Data Access Components
:
: Cheers
: Ken
:
: ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
: From: "Ron Williams" <ronwilliams32@c...>
: Subject: [asp_databases] Re: does Command Object have and Errors
: collection?
:
:
: : Yes, but i use...
: :
: : set objComm = server.createobject("adodb.command")
: : objComm.ActiveConnection = MyConnection
: :
: : ... instead of the connection object. Are you saying i can access a the
: : errors collection some how when i use this method? I guess my question
: : is, how do i do that? I have not been able to find a way and if i
switch
: : back to creating connections with the connection object, ill have to
: : change several lines of code because i set up connections as i did above
: : throughout the entire program.
: :
: : Thanks,
: :
: : Ron
: :
: : > The command object needs a connection. Check the connection object for
: : errors after executing the command object.
: :
: : Cheers
: : Ken
: :
: : ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
: : From: "Ron Williams" <ronwilliams32@c...>
: : Subject: [asp_databases] does Command Object have and Errors collection?
: :
: :
: : : This question is related to using ADO and ASP with VBScript.
: : :
: : : I know there is an 'Errors Collection' for the 'ADO connection
object',
: : : but is there an equivalent errors collection for the 'command object'?
: : If
: : : so, how do I access the properties of the command object's errors
: : : collection?
: :
: : ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
:
|
|
 |