tags:

views:

822

answers:

1

I am creating a DB wrapper and am in the need of adding SQL paramters to my stament however I do not know the parameter names or type, how can this be done? I have seen many other libraries do this...

I just want the order of values to be mapped to the stored procedure...I thought the following code would work:


public DataTable ExecuteDataTable(string storedProcName, params object[] args)
{
    SqlCommand cmd = new SqlCommand(storedProcName, conn);
    cmd.CommandType = CommandType.StoredProcedure;

    // inserting params like this does not work...
    for (int i = 0; i 

Any ideas of how to accomplish this? Note: I know there are other libraries such as the Enterprise Library that already does this, but I'm in a situation where that won't help...

Thanks.

EDIT: My code does not appear to be showing up, and I am not sure why...

+2  A: 

try here

Steven Williams
this is perfect!
mmattax