Hi
In the gridview assign data source as your dataset and datamember as the table name. Then call the adapter fill method in a button click event...
For example...
Sorry the code is in c#. I hope it is not hard to understand and change to VB.Net
private void button2_Click(object sender, EventArgs e)
{
dataGridView1.DataSource = ds;
dataGridView1.DataMember = "EmpInfo";
Dim str1 = TBSER.Text
Dim sql1 As String = "select * from EmpInfo where EmpName='" + str1 + "'"
adp = New SqlDataAdapter(sql1, cn)
adp.Fill(ds)
}
You need to have the ds should refer to an live instance of the dataset. It will fill the gridview as it is assumed a winform. If it is webform assign the datasource and datameber and then call the
gridview1.DataBind()
method (In the gidview properties autogenerate column has to set true in webform).
In case you want to go row by row then do it in a loop..
example..
DataTable dt=ds.Tables["EmpInfo"];
foreach(DataRow row in dt.rows){
TBID.Text=row.item[0];
}
But here for each loop the text box get over written. How you want to handle it. Better grid view