I just want who many number of record comes against specific query, nothing else. for example select count(column name) from table answer = 15
Dim cmd As SqlCommand = New SqlCommand("SELECT qnumber," + item + " FROM tencmpC1", cc)
Dim adp As New SqlDataAdapter(cmd)
cmd.Connection.Open()
Dim oleRdr As SqlDataReader = cmd.ExecuteReader
'txt1.Text = oleRdr.HasRows
oleRdr.Read()
Dim count As Integer
While oleRdr.Read()
count = count + 1
End While
txt1.Text = count
oleRdr.Close()
I try this code to get number of rows from query but failed to get. Please give me piece of code, anyone.