[AccessD] ADO Command object

Susan Harkins harkins at iglou.com
Tue Mar 11 13:25:01 CST 2003


No. Let me restate this and see if I can do better.

I often see Command objects in the form

Dim cnn As ADODB.Connection
Dim cmd As ADODB.Command
Set cnn = New ADODB.Connection
cnn.Open connectionstring
Set cmd = New ADODB.Command
Set cmd.ActiveConnection = cnn

when

Dim strConn As String
Dim cmd As ADODB.command
strConn = connectionstring
Set cmd = New ADODB.command
With cmd
    .ActiveConnection = strConn
...
End With

will do -- I don't see the purpose of connecting the Command object via a
Connection object. I'm assuming that it's required for certain tasks, so
what would those tasks be? So far, I've not run into anything, but then, I'm
use to simple examples.

Susan H.

----- Original Message -----
From: <Mwp.Reid at Queens-Belfast.AC.UK>
To: <accessd at databaseadvisors.com>
Sent: Tuesday, March 11, 2003 2:08 PM
Subject: Re: [AccessD] ADO Command object


> Command objects allow you to work with Stored Procedures containing output
> parameters.
>
> Allow you to sue prepared statements
>
> YOu can call a command multiple times
>
> Command Objects can be reused within an application
>
> IS this what your after?
>
>
> martin
>
> Quoting Susan Harkins <harkins at iglou.com>:
>
> > Hmmm... my understanding was that you needed the Command object to use
> > CommandType, so how would using a Connection object to connect be an
> > advantage with parameters?
> >
> > Susan H.
> >
> >
> > > One major one is that the Command object has the parameters
> > collection
> > that
> > > is vital to either passing parameters to a Stored Procedure or a
> > > paramterized Query.
> > >
> > > Chris Mackin
> > > www.denverdb.com
> > > Denver Database Consulting, LLC
> > >
> > >
> > > -----Original Message-----
> > > From: accessd-admin at databaseadvisors.com
> > > [mailto:accessd-admin at databaseadvisors.com]On Behalf Of Susan
> > Harkins
> > > Sent: Tuesday, March 11, 2003 10:56 AM
> > > To: AccessD at databaseadvisors.com
> > > Subject: [AccessD] ADO Command object
> > >
> > >
> > > I see a lot of code that uses the Command object but connects via a
> > > Connection object, when a Command object can do the same thing. I
> > assume
> > > this arrangement nets advantages -- can someone name a few?
> > >
> > > Susan H.
> > >
> > >
> > >
> > >
> > > _______________________________________________
> > > AccessD mailing list
> > > AccessD at databaseadvisors.com
> > > http://databaseadvisors.com/mailman/listinfo/accessd
> > > Website: http://www.databaseadvisors.com
> > >
> > >
> > >
> > > _______________________________________________
> > > AccessD mailing list
> > > AccessD at databaseadvisors.com
> > > http://databaseadvisors.com/mailman/listinfo/accessd
> > > Website: http://www.databaseadvisors.com
> > >
> > >
> >
> > _______________________________________________
> > AccessD mailing list
> > AccessD at databaseadvisors.com
> > http://databaseadvisors.com/mailman/listinfo/accessd
> > Website: http://www.databaseadvisors.com
> >
> _______________________________________________
> AccessD mailing list
> AccessD at databaseadvisors.com
> http://databaseadvisors.com/mailman/listinfo/accessd
> Website: http://www.databaseadvisors.com
>
>




More information about the AccessD mailing list