OleDbCommand parameters order and priority

According to http://msdn.microsoft.com/en-us/library/system.data.oledb.oledbcommand.parameters.aspx OleDbCommand does not support named parameter

The OLE DB .NET Provider does not support named parameters for passing parameters to an SQL statement or a stored procedure called by an OleDbCommand when CommandType is set to Text. In this case, the question mark (?) placeholder must be used. For example:

SELECT * FROM Customers WHERE CustomerID = ?

Therefore, the order in which OleDbParameter objects are added to the OleDbParameterCollection must directly correspond to the position of the question mark placeholder for the parameter in the command text.

So order of parameter is important.


If I recall correctly, if the OleDbCommand in ADO.NET functions similarly to the older ADO library/libraries (used in VB6, VBA, etc.) then the parameter collection does not define parameters by name, only by position within the collection. This seems to be the behaviour you are experiencing.