OleDB cannot use named parameters

  • Thread starter Thread starter Homa
  • Start date Start date
H

Homa

Hi,
I read the document saying that OleDB cannot use named parameters, so
the command must be in the form:

"Select z from foo_T where b = ? And c = ?"

I thought this is the limitation of the database, but I found out when
I use Access, I can actually use named parameter to do the query, but
the OleDBCommand does not allow me to do it 'normally'

For example, when I create a OleDBDataAdapter (I'm using VS.NET 03),
when configuring it using the wizard, I can do this:

"Select a from foo_T where b = @b And c = @c Or c = @c And d = @d"

And when I run this in the query builder, the correct result comes
out.

So it seems like the "cannot use named parameters" is a limitation of
OleDBCommand rather than the database itself

Is there a way to get around this?

What do you think?


Best Regards,
Homa Wong
 
Hi Homa,

Does this document help?

Using Stored Procedures with a Command
http://msdn.microsoft.com/library/d...tml/cpconusingstoredprocedureswithcommand.asp

And read the section "Using Parameters with an OleDbCommand or OdbcCommand" in particular. It says it all.

I hope this helps!


Thanks,
Hussein Abuthuraya
Microsoft Developer Support

This posting is provided "AS IS" with no warranties, and confers no rights.

Are you secure? For information about the Microsoft Strategic Technology Protection Program and to order your FREE Security Tool Kit, please visit
http://www.microsoft.com/security.
 
Back
Top