Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
ADO Command Object Question
Message
From
03/03/2000 22:02:31
 
 
To
03/03/2000 18:08:19
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Miscellaneous
Thread ID:
00341085
Message ID:
00341601
Views:
25
>Hi JCF:
>
>I had a feeling you'd be answering this one for me :o)
>As always, thanks. I'll try it out and let you know.
>
>Mal
>
>>>Hi All:
>>>
>>>I've been able to execute a Stored Procedure in SQL SERVER 7.0 using the ADO Command Object passing 1 parameter via a COM (.exe) I wrote in VFP. It works great and it's SUPER fast.
>>>
>>>Now I need to send THREE (3) parameters to the Stored Procedure and I'm not sure how this is done. I've tried this ...
>>>
>>>I've tried this ....
>>>
>>>DIMENSION aParameters[3]
>>>aParameters[1] = lnFirstVar
>>>aParameters[2] = lnSecondVar
>>>aParameters[3] = lnThirdVar
>>>oCommand.Execute(,@aParameters,)
>>>
>>>... and it didn't work. What am I doing wrong here? Is it possible to send more than one parameter?
>>>
>>>Thanks In Advance,
>>>
>>>Mal
>>
>>While you can do it with arrays, it is more efficient if you use the parameters collection. What you have to do is define the parameters with the command's .CreateParameter method and then append them with the commands's .Append method. syntax is as follows:
>>
>>prm = myCmdObject.CreateParameter(cName, nDataType, nPrmType, eValue)
>>myCmdObject.Append(prm)
>>
>>and then just execute the with .Execute

Slight correction: The .CreateParameter method is missing the size argument. You might want to check the ADO documentation on both methods.

Also, I will be posting a little utility that simplifies this sort of stuff.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform