how i supplement sqlparameters but meaningful name / type?
i am formulating db coupling am need adding sql paramters stament however i know parameter names type, done? i have seen libraries this...
i only wish method values mapped stored procedure...i guess following formula work:
public datatable executedatatable(string storedprocname, params object[] args)
{
sqlcommand cmd = new sqlcommand(storedprocname, conn);
cmd.commandtype = commandtype.storedprocedure;
// inserting params does work...
(int i = 0; i < args.length; i++)
{
cmd.parameters.insert(i, args[0]);
}
datatable dt = new datatable();
dt.load(cmd.executereader());
relapse dt;
}
any ideas accomplish this? note: i know there libraries such craving library already does this, nonetheless i'm conditions where won't help...
thanks.
Comments
Post a Comment