0
Try this in Class
Public DataSet GetData()
{
SqlConnection _sqlcncn=new SqlConnection("ConnectionString);
SqlCommand sqlcmd = new SqlCommand("Select Query", sqlcn);
// sqlcmd.CommandType = CommandType.StoredProcedure;
sqlcn.Open();
DataSet ds = new DataSet();
sqlda = new SqlDataAdapter(sqlcmd);
sqlda.Fill(ds);
return ds;
}
In code behind call this method like bello
DataSet ds=Class.GetData();
Gridview.DataSource=ds.Tables[0];
GridView.DataBind();
Accepted 0
Thanks sir! Help is greatly appreciated.
0
Hi sir,
Thank you for answering that question. But I have another problem regarding that. I don't know how will I use that method and bind it in the gridview. Can you give me a simple example? Thanks again sir.
Jirr
0
Create a method in a class and call this method in page load event if you want to show the details on load or in any another event also.