There is no row at position 0.
Dim str1 = TBSER.Text Dim sql1 As String = "select * from EmpInfo where EmpName='" + str1 + "'" adp = New SqlDataAdapter(sql1, cn) ds.Clear() adp.Fill(ds) TBID.Text = ds.Tables("EmpInfo").Rows(inc).Item(0) TBNAME.Text = ds.Tables("EmpInfo").Rows(inc).Item(1) TBAD1.Text = ds.Tables("EmpInfo").Rows(inc).Item(2) TBAD2.Text = ds.Tables("EmpInfo").Rows(inc).Item(3) CBCITY.Text = ds.Tables("EmpInfo").Rows(inc).Item(4) TBTEL1.Text = ds.Tables("EmpInfo").Rows(inc).Item(5) TBTEL2.Text = ds.Tables("EmpInfo").Rows(inc).Item(6) TBMOB.Text = ds.Tables("EmpInfo").Rows(inc).Item(7) CBFAC.Text = ds.Tables("EmpInfo").Rows(inc).Item(8)
if(ds.Tables["EmpInfo"].Rows.Count == 0) { //your code here }
Parameterized Queries
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)