[AccessD] ADO Command object

Charlotte Foust cfoust at infostatsystems.com
Tue Mar 11 14:43:00 CST 2003


You have to get to the connection through the command object.

    For Each errADO In cmd.ActiveConnection.Errors

Charlotte Foust

-----Original Message-----
From: Susan Harkins [mailto:harkins at iglou.com] 
Sent: Tuesday, March 11, 2003 12:01 PM
To: accessd at databaseadvisors.com
Subject: Re: [AccessD] ADO Command object


How do you handle errors in a Command object then? 

Susan H. 


> Well, the Connection object has properties that make it easier to see 
> and set the various pieces of the connection string instead of 
> creating one huge string that you then may have to debug when it 
> doesn't work. You can't get there through the Command object.  It also

> has the errors collection you'll need for any error trapping.  I 
> personally find it easier to work with cnn.Errors than having to go 
> through the command object first.
> 
> Charlotte Foust
> 
> -----Original Message-----
> From: Susan Harkins [mailto:harkins at iglou.com]
> Sent: Tuesday, March 11, 2003 11:24 AM
> To: accessd at databaseadvisors.com
> Subject: Re: [AccessD] ADO Command object
> 
> 
> 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
> >
> >
> 
> _______________________________________________
> 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