VB .NET odbc help

GoHAnSoN

Senior member
Mar 21, 2001
732
0
0
I need to popup a text box when the search returns empty.
How do i do that ?? Have been googling all around, cannt find the answer.

Anyone help pls ?
Here's piece of my code.

Try
Me.DataSet11.Clear()
Me.OdbcConnection1.ConnectionString = connectionString
Me.OdbcSelectCommand1.CommandText = searchString
Me.OdbcSelectCommand1.Connection = OdbcConnection1
' Open connection
Me.OdbcConnection1.Open()

# add code here for "if empty do something" ? But how ?
#

Me.OdbcDataAdapter1.Fill(DataSet11)

Me.OdbcConnection1.Close()


Catch Excep As Exception
Me.OdbcConnection1.Close()
MessageBox.Show(Excep.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error)

End Try
 

Mark R

Diamond Member
Oct 9, 1999
8,513
16
81
If DataSet11.Tables(0).Rows.Count = 0 Then
' Nothing was found
Else
'Something was found
 

GoHAnSoN

Senior member
Mar 21, 2001
732
0
0
got any better ones ? i was actually looking for an exception... is there any ? or i have to settle with rows.count ?
 

rsd

Platinum Member
Dec 30, 2003
2,293
0
76
Originally posted by: GoHAnSoN
got any better ones ? i was actually looking for an exception... is there any ? or i have to settle with rows.count ?

You won't receive an exception if your query returns no data. It is simply that, no data/nothing.