SqlHelper ExecuteDataSet with named parameters?

2.5k Views Asked by At

Currently I'm using SqlHelper.ExecuteDataSet(string storedProcedure, Object[] parameters); to retrieve data from the database. The issue resides in the fact that order matters. I recently abstracted some of the functionality that produces the Object[] parameters which caused them to get out of order a bit. I was wondering if there was a way to call this function (simplistically) my specifying the names?

The only other solution I could come up with is make a function myself to order them properly, though this seems subpar to an already existing way of doing it.

Question: Is there a way to call SqlHelper.ExecuteDataSet with a set of named parameters? (Such as with a Dictionary<String, Object> or something of the sort)?

2

There are 2 best solutions below

4
On BEST ANSWER

SqlHelper is obsolete. It was replaced by the Database object from MS Enterprise Library, but this is also obsolete. What functionality are you trying to extrude from it? You might be better off building your own abstraction layer using the Enterprise Library as a starting point.

0
On