private void BindingMyData() { MySqlConnection Mycon = new MySqlConnection(myDatabase); Mycon.Open(); MySqlDataAdapter sqlDataAdapter = new MySqlDataAdapter("select * from EntrepreneurialTechnology.User", Mycon); DataTable MyDataTable = new DataTable(); sqlDataAdapter.Fill(MyDataTable); GridViewAllUser.DataSource = MyDataTable; GridViewAllUser.DataBind(); }
protected void Page_Load(object sender, EventArgs e) { if (Session["UsernameAdmin"] != null) { LinkAdminLogout.Visible = true; linkViewAllAppointment.Visible = true; linkAdminUsername.Text = "Hello " + Session["UsernameAdmin"]; MySqlConnection Mycon = new MySqlConnection(myDatabase); Mycon.Open(); MySqlDataAdapter sqlDataAdapter = new MySqlDataAdapter("select * from EntrepreneurialTechnology.User", Mycon); DataTable MyDataTable = new DataTable(); sqlDataAdapter.Fill(MyDataTable); GridViewAllUser.DataSource = MyDataTable; GridViewAllUser.DataBind(); } }