Hi,
Its been a long time since I have had the joy of feeding parameterized
query CommandText strings to an OleDBCommand object.
I have tried all manner of versions of " update foo set bar = @bar
where id = @id"
I have wrapped the fields in square brackets and the parameters in
square brackets and all manner of other strange variations.
The ExecuteNonQuery fires but the table doesn't update.
Finally went back to the old standby of ? as parameter place holder
and relying on Parameters ordinal position in the collection.
Is it really still this primitive or am I just screwing up the syntax?
Thanks
Bob
Scott M. - 24 Apr 2008 05:05 GMT
With Access and OleDB Providers you can use either the ? or the @, but the
parameters MUST be added to the command's parameters collection in the same
order that they are referenced in the update statement.
-Scott
> Hi,
> Its been a long time since I have had the joy of feeding parameterized
[quoted text clipped - 12 lines]
> Thanks
> Bob
bob - 24 Apr 2008 21:04 GMT
Hi Scott,
Thanks for your reply.
I'll leave the question marks in place to remind me that ordinal
position is important.
regards
Bob
>With Access and OleDB Providers you can use either the ? or the @, but the
>parameters MUST be added to the command's parameters collection in the same
[quoted text clipped - 18 lines]
>> Thanks
>> Bob
Ignacio Machin ( .NET/ C# MVP ) - 24 Apr 2008 14:55 GMT
On Apr 23, 11:55 pm, bob <startatbob_cl...@cutthis.adriley.co.nz>
wrote:
> Hi,
> Its been a long time since I have had the joy of feeding parameterized
[quoted text clipped - 12 lines]
> Thanks
> Bob
Hi,
Unfortunatelly it's :(
bob - 24 Apr 2008 21:08 GMT
Hi Ignacio,
Thanks for your reply.
Scott says you can actually use named parameters but yes ordinal
position must be watched. I am going to stick with the question marks
so I don't fall for the same trap again.
regards
Bob
>On Apr 23, 11:55 pm, bob <startatbob_cl...@cutthis.adriley.co.nz>
>wrote:
[quoted text clipped - 18 lines]
>
>Unfortunatelly it's :(