views:

529

answers:

3

I'm a complete newbie to VB.NET, how can I test if a dataset has rows? I'm trying to see if my sql procedure call managed to fill up my dataset.

Also, is there an easy way to print the rows to a label?

+2  A: 

Have you tried DatasetName.Tables[0].Rows.Count?

NewbieToJava
Awesome! Thank you! Now... I just need to figure out how to JSON format the dataset.
cc0
@cc0 you might find this helpful: http://stackoverflow.com/questions/451460/datatable-to-json
Joel Coehoorn
+1  A: 
If myDataSet.Tables.Count > 0 AndAlso myDataSet.Tables(0).Rows.Count > 0 Then
  ' The first table contains rows.
End If
Sani Huttunen
+1  A: 

Rather than printing to a label, it would be advisable to bind it to an auto-generated gridview.

Drop a gridview onto a page, and once you have your dataset (which I'm assuming has a table you expect data in), drop in the following code

GridView1.DataSource = myDataSet.TableName  // if it's strongly typed, use Tables[index] otherwise
GridView1.DataBind()
Joel Etherton