Recordcount in vb.net

  • Thread starter Thread starter Goen
  • Start date Start date
G

Goen

iam usualy use this statement in vb6

Rs.Open "Select * from myTable",Con,1,3
If Rs.Recordcount =0 then
msgbox "Table Empty"
else
msgbox "Total record are : " & Rs.Recordcount
endif

Does any know how to do that in vb.net with ado.net

Thanks
 
Hi Geon,

Assuming you have a table inside a dataset, thus:

Dim daprod As New SqlDataAdapter("select * from prod where
substring(issuecode,1,6) >= '200204' and pubcode = '003' order by title",
oconn)

Dim dsprod As New DataSet("prod")

daprod.Fill(dsprod, "prod")

dim i as integer

i = dsprod.tables(0).rows.count

HTH,

Bernie Yaeger
 
Back
Top