Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase 1234»»»

Introduction to ADO - The Command Object Expand / Collapse
Author
Message
Posted Friday, November 16, 2001 12:00 AM
SSCertifiable

SSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiable

Group: Moderators
Last Login: 2 days ago @ 10:51 AM
Points: 6,779, Visits: 1,860
Comments posted to this topic are about the content posted at http://www.sqlservercentral.com/columnists/awarren/introductiontoadothecommandobject.asp>http://www.sqlservercentral.com/columnists/awarren/introductiontoadothecommandobject.asp

Andy
SQLAndy - My Blog!
Connect with me on LinkedIn
Follow me on Twitter
Post #1654
Posted Wednesday, December 5, 2001 4:33 AM
Forum Newbie

Forum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum Newbie

Group: General Forum Members
Last Login: Thursday, August 8, 2002 12:00 AM
Points: 4, Visits: 1
I have used command object a lot, mostly in the "right" way that has been mentioned. I think that a clearer example of the wrong way could have been explained. If you how wrong something can be, then it will be easier to understand why not to follow in that direction.






Post #24032
Posted Wednesday, December 5, 2001 4:55 AM
SSCertifiable

SSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiable

Group: Moderators
Last Login: 2 days ago @ 10:51 AM
Points: 6,779, Visits: 1,860
I'll keep in that mind for the follow up. Thanks for the feedback.


Andy


Andy
SQLAndy - My Blog!
Connect with me on LinkedIn
Follow me on Twitter
Post #24033
Posted Monday, January 21, 2002 12:23 AM
Grasshopper

GrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopper

Group: General Forum Members
Last Login: Thursday, July 28, 2005 1:01 AM
Points: 17, Visits: 1
Maybe you could elaborate on the
cmd.Name -parameter. I have had some problems with that.






Post #24034
Posted Monday, January 21, 2002 4:43 AM
SSCertifiable

SSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiable

Group: Moderators
Last Login: 2 days ago @ 10:51 AM
Points: 6,779, Visits: 1,860
Problems in what way?


Andy


Andy
SQLAndy - My Blog!
Connect with me on LinkedIn
Follow me on Twitter
Post #24035
Posted Wednesday, March 20, 2002 7:47 AM
Forum Newbie

Forum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum Newbie

Group: General Forum Members
Last Login: Tuesday, May 28, 2013 10:28 AM
Points: 8, Visits: 190
I have tried to use the Command object in the past, although I have been able to use input paramaters I have been unable to use input/output or just output, can you explain a little more in depth about those? Also is there any benifit to using the ADO "Hints" over the constants?




Post #24036
Posted Wednesday, March 20, 2002 8:25 AM
SSCertifiable

SSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiable

Group: Moderators
Last Login: 2 days ago @ 10:51 AM
Points: 6,779, Visits: 1,860
You might want to look at a later article I did that covers a VB add in that will generate the command object code for you, a real time saver. I use output params regularly with no problem, just a matter of getting everything set up right. What hints are you referring to?


Andy


Andy
SQLAndy - My Blog!
Connect with me on LinkedIn
Follow me on Twitter
Post #24037
Posted Tuesday, March 11, 2003 12:33 PM
Forum Newbie

Forum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum Newbie

Group: General Forum Members
Last Login: Tuesday, October 19, 2004 1:51 PM
Points: 4, Visits: 1
Thanks for the article. I found it very interesting and helpful.

I still have this problem:

' Parameter 1
sParmName1 = "@Cusip"
ocommand.Parameters.Append ocommand.CreateParameter(sParmName1, adVarChar, adParamInput)
params(sParmName1).Value = sSymbol

' Parameter 2
sParmName2 = "@Price" '
Set ADOprm = ocommand.CreateParameter(sParmName2, adNumeric, adParamInput)
ocommand.Parameters.Append ADOprm
ocommand.Parameters(sParmName2).Value = sPrice

The stored procedure is:
create procedure dbo.UpdateLastPriceRaw
(
@Cusip VARCHAR(15),
@Price NUMERIC(17,9)
)
AS

Parameter 1 works fine - but Parameter 2 brings the following error:

The precision is invalid.
?err.Number
-2147467259

If I use the params.refrsh method it works fine (commenting out the ADOPrm SET line)

Is there a way to find out what the error means and how to solve it without using params.refresh?





Post #24038
Posted Tuesday, March 11, 2003 12:45 PM
SSCertifiable

SSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiable

Group: Moderators
Last Login: 2 days ago @ 10:51 AM
Points: 6,779, Visits: 1,860
I'll try to look tonight, but a good way to resolve things like this is to do parameters.refresh, then iterate the collection to dump out all the property settings to see what it's using.

Andy
http://www.sqlservercentral.com/columnists/awarren/




Andy
SQLAndy - My Blog!
Connect with me on LinkedIn
Follow me on Twitter
Post #24039
Posted Thursday, March 13, 2003 2:25 AM
SSCrazy

SSCrazySSCrazySSCrazySSCrazySSCrazySSCrazySSCrazySSCrazy

Group: General Forum Members
Last Login: 2 days ago @ 2:19 PM
Points: 2,891, Visits: 1,781
I do a lot of Web development and one of the problems I find is that the constants (adCmdStoredProcedure) used to indicate command types are rarely defined outside of an MS app. For example, I use DreamWeaver quite a bit.

I have the ADO2.6 command reference book, and yes, in appendix B it has the definitions of these constants, but wouldn't it be great if someone wrote a book that listed the constants and their values before the example code?

Incidentally, I have a problem where I am trying to access two separate databases within a Site Server implementation.

If I have a page that accesses my user database using my connection string then everything works OK. Ditto the Site Server functionality.

If I try and use both together on the same page everything goes beserk!

I have tried defining two separate connections but I keep getting Accessed Denied error messages.

Both SiteServer and my user databases are using Windows Integrated security. Both have the required user set up and yet I still get Access Denied!

If I use SA then I am allowed in but there is no way I want to release a piece of code that uses the SA login and password!

Has anyone had anything similar?





LinkedIn Profile
Newbie on www.simple-talk.com
Post #24040
« Prev Topic | Next Topic »

Add to briefcase 1234»»»

Permissions Expand / Collapse