Private Sub btnsearch_Click(sender As Object, e As EventArgs) Handles btnsearch.Click DGV_empno.Rows.Clear() Try con.Open() com = New SqlCommand("SELECT * from emp_master where empid=@empid", con) com.Parameters.AddWithValue("@empid", txtempno.Text) dr = com.ExecuteReader While dr.Read i = DGV_empno.Rows.Add(+1) DGV_empno.Rows(i).Cells(0).Value = dr("empid") DGV_empno.Rows(i).Cells(1).Value = dr("empname") DGV_empno.Rows(i).Cells(2).Value = dr("dob") DGV_empno.Rows(i).Cells(3).Value = dr("doj") DGV_empno.Rows(i).Cells(4).Value = dr("dept") DGV_empno.Rows(i).Cells(5).Value = dr("desig") DGV_empno.Rows(i).Cells(6).Value = dr("exp") DGV_empno.Rows(i).Cells(7).Value = dr("salary") End While Catch ex As Exception MsgBox(ex.Message) Finally dr.Close() con.Close() End Try End Sub
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)