Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Data doesn't exist..? 1

Status
Not open for further replies.

kenjoswe

Technical User
Sep 19, 2000
327
0
0
SE
Hi all,

I have the following:
==================
SQLSelect = "SELECT * from MyTable where Field1='" & strVar & "'"

Dim mySqlDA As New System.Data.SqlClient.SqlDataAdapter(SQLSelect, strConn)
Dim myDS As New System.Data.DataSet()

mySqlDA.Fill(myDS)
===================
..how can I handle the case if no records are retrived from the
SQL-statement?

I want to check the datset before proceeding.
Something like:

If isnull(myDS)=true then
Label1.Text="'What you asked for doesn't exist!"
exit sub
endif

/Kent J.
 
If myDS.Tables("myTable").Rows.Count = 0 then
Label1.Text="'What you asked for doesn't exist!"
exit sub
End If
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top