princesszea
Technical User
Hi,
I’m using the code below to get a datatable.
I need to get 2 datatables using this method and I want to end up with one dataset.
Can someone please tell me the best way to this. As I’m basically repeating the code below to and changing the stored procedure.
Thanks
I’m using the code below to get a datatable.
I need to get 2 datatables using this method and I want to end up with one dataset.
Can someone please tell me the best way to this. As I’m basically repeating the code below to and changing the stored procedure.
Thanks
Code:
DataTable dt = new DataTable();
try
{
using (SqlCommand cmd = sqlConn.CreateCommand())
{
Dictionary<string, string> parameters = (Dictionary<string, string>)HttpContext.Current.Session["SearchDictionary"];
cmd.CommandType = CommandType.StoredProcedure;
cmd.CommandText = StoredProcedures.sp1;
foreach (KeyValuePair<string, string> p in parameters)
{
string key = p.Key;
string value = p.Value;
///<remarks>Creates the parameter</remarks>
cmd.Parameters.AddWithValue(key, value);
}
using (SqlDataAdapter da = new SqlDataAdapter(cmd))
{
da.Fill(dt);
}
this._data = dt;
}