How to retrive data from mysql database (xampp)

Mar 4 2018 11:19 AM
Im trying to retrieve data from Mysql database using Gridview or html table 
 
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
BindGridviewData();
}
}
public void BindGridviewData()
{
using (MySqlCommand cmd = new MySqlCommand("select * from login", con))
{
con.Open();
DataSet ds = new DataSet();
using (MySqlDataAdapter da = new MySqlDataAdapter(cmd))
{
da.Fill(ds);
gvDetails.DataSource = ds;
gvDetails.DataBind();
}
}
}
 
 
 Thanks in advance :)

Answers (1)