IDbDataParameter

  • Thread starter Thread starter Fred Chateau
  • Start date Start date
F

Fred Chateau

Could someone please tell me how to create an array using the
IDbDataParameter?
 
For further clarification, I am trying to pass parameters to this signature.


protected virtual DataSet GetDataSet(string command, params
IDbDataParameter[] dataParams)
 
I've found working with xxxParameter objects very combersome, in most
providers you can't create them directly (have to be created through a
command) and in some providers they cause errors if you reuse a
parameter for multiple command executions (sybase).

I resorted to use a custom Parameters collection which is an extension
of IDictionary<string, object> and then I create the necessary
parameter objects as needed. I've found this to be much easier to
work with in my internal code than trying to use db parameter objects
directly.

Of course this has lots of limitations, like no support for output
parameters or non-default type mapping, but I haven't and don't
anticipate needed those features--your project might be different
though.

HTH,

Sam
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top