I am using MySQL as DB and I want to retrieve table data to GridView in my browser. Below is the code I am using, there are no errors but if I run the page, it shows blank
MySqlConnection myconn = new MySqlConnection("server=localhost;user id=;password=;database=workers;");
string strSQL = "select * from details";
MySqlDataAdapter mydata = new MySqlDataAdapter(strSQL, myconn);
MySqlCommandBuilder cBuilder = new MySqlCommandBuilder(mydata);
DataSet ds = new DataSet();
mydata.Fill(ds);
GridView1.DataSource = ds;
GridView1.DataBind();
myconn.Close();
I have tried with Microsoft SQL Server DB by adding DB file and same content in DB, then it worked.
you did not open your connections. try it by adding this
before this line