protected void Button1_Click(object sender, EventArgs e)
{
SqlConnection con = new SqlConnection("Data Source=(local);Database=Test;user id=sa;pwd=####");
con.Open();
SqlDataAdapter sq = new SqlDataAdapter("SELECT *From Employee", con);
DataSet ds = new DataSet();
sq.Fill(ds, "Employee");
ArrayList arrList = new ArrayList();
foreach (DataRow dr in ds.Tables[0].Rows)
{
arrList.Add(dr["Name"]);
GridView1.DataSource = arrList;
GridView1.DataBind();
string[] strArray = arrList.ToArray(typeof(string)) as string[];
}
sq.Dispose();
con.Close();
Response.Write("Done!");
}
}