|
-
Oct 24th, 2002, 07:33 AM
#1
Thread Starter
Lively Member
Order of Params when calling sproc using ADO Command object
I'm trying to call a parameterized sproc using the ADO command object. Problem is, that despite the fact that I am referencing the params by name, it still seems to insist that I put them in the order in which they are specified in the sproc.
Is this true or have I got some sort of setting missing that would allow me to pass the params in a way more suited to my application?
-
Oct 24th, 2002, 08:29 AM
#2
Member
Quite frankly, I don't think it is possible to change the order of your ADO parameters, unless you declare a unique ADODB.Parameter for each parameter.
Something like:
dim MyAdoVar1 as ADODB.Parameter
dim MyAdoVar2 as ADODB.Parameter
set MyAdoVar1 = new ADODB.Parameter
set MyAdoVar2 = new ADODB.Parameter
then for example, MyAdoVar2 is given a value first... =25
then MyAdoVar1 = 50 (this is not the syntax, just an example)
But you'll still need to append them in the correct order:
cmdAdo.Parameters.Append MyAdoVar1
cmdAdo.Parameters.Append MyAdoVar2
Hope this helps
MartinLG
Tell me, and I will forget. Show me, and I will remember. Involve me, and I will care.
-
Oct 24th, 2002, 01:34 PM
#3
What version of ADO are you using? ADO 2.6 introduced a new property in the Command object called NamedParameters. If set to True then ADO uses the parameter names (which must
exactly match the stored procedure parameter names) otherwise it uses the ordinal position.
This property is provider specific so don't rely on all of them implementing this method. Also I think it is no longer a requirement to create a parameter object for every stored procedure parameter. Parameters that have default values need not be passed.
HTH
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|