protected void Page_Load(objectsender, EventArgs e)
{if (!IsPostBack)
{string conString = ConfigurationManager.ConnectionStrings["DemosDatabaseConnectionString"].ConnectionString;string query = "SELECT * FROM Customers";using (SqlConnection con = newSqlConnection(conString))
{using (SqlCommand cmd = newSqlCommand(query))
{using (SqlDataAdapter sda = newSqlDataAdapter())
{
cmd.Connection=con;
sda.SelectCommand=cmd;using (DataTable dt = newDataTable())
{
sda.Fill(dt);
StringBuilder str= newStringBuilder();
StringBuilder str1= newStringBuilder();
str.Append("
str.Append("
");for (int k = 0; k < dt.Columns.Count; k++){
str.Append("
");str.Append(dt.Columns[k].ColumnName);
str.Append("
");}
str.Append("
");str.Append("");
str.Append("
");str.Append("
");for (int i = 0; i < dt.Rows.Count; i++){
str.Append("
");for (int k = 0; k < dt.Columns.Count; k++){
str.Append("
");str.Append(dt.Rows[i][k]);
str.Append("
");}
str.Append("
");str.Append("");
str.Append("
");str.Append("
");}
str.Append("
");str.Append("
str.Append("
");for (int k = 0; k < dt.Columns.Count; k++){
str.Append("
");str.Append("Head");
str.Append("
");}
str.Append("
");for (int i = 0; i < dt.Rows.Count; i++){
str.Append("
");for (int k = 0; k < dt.Columns.Count; k++){
str.Append("
");str.Append("Test");
str.Append("
");}
str.Append("
");}
str.Append("
");divUsers.InnerHtml=str.ToString();
}
}
}
}
}
}