After I submitted my query I got an empty dataset. A populated dataset brings back 2 columns and I want to add data to an empty dataset. I am a newbie to VB.net. I've inherited this vb.net windows app and need to account for an empty dataset and populate the 2 columns appropriate when no data is returned.
I want to populate a NULL value in the first column and a string value in the 2nd column of this dataset. I just don't know how to populate this dataset and needing some help/direction.
I tested to see if the dataset was empty by using the following after googling and finding the DataRow class but I'm having problems:
The ELSE part of my code above is NOT working. Again any help or direction would be appreciated. I'm sure I'm missing something simple but just don't know what.

I want to populate a NULL value in the first column and a string value in the 2nd column of this dataset. I just don't know how to populate this dataset and needing some help/direction.
I tested to see if the dataset was empty by using the following after googling and finding the DataRow class but I'm having problems:
VB.NET:
If odataset.Tables(0).Rows.Count() > 0 Then
allDataGrid.DataSource = odataset.Tables(0)
allDataGrid.DataBind() -- WORKS GREAT!!
Else
Dim drow As DataRow
Dim value1 As String
Dim value2 As String
value1 = ""
value2 = "No records found"
drow.ItemArray[value1, value2]
odataset.Tables(0).Rows.Add(drow)
allDataGrid.DataSource = odataset.Tables(0)
allDataGrid.DataBind()
End If
The ELSE part of my code above is NOT working. Again any help or direction would be appreciated. I'm sure I'm missing something simple but just don't know what.
Last edited: