//NOTE: This will help you to get the first
table and second table from your store_procedure returning at once
public void MethodName()
{
DALayer layer = new
DALayer();
SqlConnection cn = layer.ReturnConnection();
SqlDataReader reader = null;
#region Post
try
{
string strQuery = "ProcedureName";
string strError = string.Empty;
SqlCommand cmd = new
SqlCommand(strQuery, cn);
cmd.CommandType = CommandType.StoredProcedure;
cmd.Parameters.AddWithValue("@ParameterName",”Value”);
reader = cmd.ExecuteReader();
Blogtopic.InnerHtml = string.Empty;
//FIRST_TABLE
while (reader.Read())
{
//This will get the result from the first
table only return by your storeprocedure
}
//SECOND_TABLE
if (reader.NextResult())
{
while (reader.Read())
{
//This will get the
result from the second table return by your storeprocedure
}
}
}
catch (Exception
ex)
{
return;
}
finally {
reader.Close();
cn.Close();
}
#endregion
}
No comments:
Post a Comment