using System;using System.Data;using System.Data.Sql;using System.Data.SqlClient;using System.Configuration;using System.Web;using System.Web.Security;using System.Web.UI;using System.Web.UI.WebControls;using System.Web.UI.WebControls.WebParts;using System.Web.UI.HtmlControls;
public partial class _Default : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e) { Table tbl = myTable;
SqlDataReader drGroups,Questions;
using (SqlConnection dbConn = new SqlConnection(ConfigurationManager.ConnectionStrings["sqlcon"].ToString())) { SqlCommand cmd = new SqlCommand(); cmd.Connection = dbConn; cmd.Connection.Open();
cmd.CommandText = "Select * from GROUPS"; drGroups = cmd.ExecuteReader(); if (drGroups.HasRows) { while (drGroups.Read()) { TableRow tr = new TableRow(); tbl.Rows.Add(tr); TableCell Group = new TableCell(); Group.Text = drGroups.GetValue(1).ToString(); Group.Width = Unit.Percentage(100); tr.Controls.Add(Group); } }
} }}