you can use this way...here i mention storeprocedure "sp_test" which returns more then 1 tables then you can used this tables in below way...
public DataTable GetData()
{
SqlConnection conn = new SqlConnection(ConfigurationManager.ConnectionStrings["TestConString"].ConnectionString);
conn.Open();
SqlCommand cmd = new SqlCommand("sp_test", conn);
cmd.CommandType = CommandType.StoredProcedure;
SqlDataAdapter MyDataAdapter = new SqlDataAdapter();
DataSet DS = new DataSet();
try
{
MyDataAdapter.SelectCommand = cmd;
MyDataAdapter.Fill(DS);
if (DS != null && DS.Tables.Count > 0 && DS.Tables[0].Rows.Count > 0)
{
return DS.Tables[0];
}
else
{
return null;
}
}
catch (SqlException )
{
throw ;
}
finally
{
if (conn.State == ConnectionState.Open)
conn.Close();
conn = null;
}
}
may be this can help you...Thanks if you get your answer then please make as answered...