string ConnectionString = ConfigurationManager.ConnectionStrings["Northwind"].ConnectionString;
protected void Page_Load(object sender, EventArgs e)
{
SqlConnection con = new SqlConnection(ConnectionString);
try
{
con.Open();
string sqlcmd = "SELECT TOP 5 * FROM Employees;" +
"SELECT TOP 5 * FROM Customers;SELECT TOP 5 * FROM Suppliers";
SqlCommand cmd=new SqlCommand(sqlcmd,con);
SqlDataReader reader=cmd.ExecuteReader();
StringBuilder htmlString = new StringBuilder("");
int i = 0;
do
{
htmlString.Append("RowSet: ");
htmlString.Append(i.ToString());
htmlString.Append("");
while (reader.Read())
{
htmlString.Append("
// Get all the fields in this row.
for (int field = 0; field <>");
}
htmlString.Append("
");
i++;
}
while (reader.NextResult());
Response.Write(htmlString.ToString());
}
catch (Exception ex)
{
Response.Write(ex.Message);
}
finally
{
con.Close();
}
}
: