Home All Groups Group Topic Archive Search About

OleDbCommand String & Parameters

Author
13 May 2006 4:47 PM
Alex Maghen
When I set the CommandText of an OleDbCommand and I want to include
parameters that I'll them populate with OleDbCommand.Parameters.Add(), it
looks like I can either use the question mark character (?) or an "@variable"
construction in the CommandText.

But after that, it looks like regardless of whether I use "?" or
"@variable", when I go to do the OleDbCommand.Parameters.Add()s afterward,
the only thing that matters is the *order* in which I call those Add()
functions, NOT the name I give in the first parameter of the Add() function.
Is this right? Isn't that a little... ugly???

Alex

Author
14 May 2006 5:28 AM
Cor Ligthert [MVP]
Alex,

That is right what you saw, that is OleDB behaviour, with (some) other
providers the parameters can be named.

In OledB you can even leave the parameter blank when adding parameters.

I hope this helps,

Cor

AddThis Social Bookmark Button