empty dataset returned
From: kellydotnetnewbie (kelly.heinz_at_co.macomb.mi.us)
Date: 10/30/03
- Next message: Thomas Miller: "requirement: change users pswd at future pre-determined time wo storing in db - challenge"
- Previous message: Bill: "Re: SIMPLE algorithm that took me by surprise."
- Next in thread: Eric Veltman: "Re: empty dataset returned"
- Reply: Eric Veltman: "Re: empty dataset returned"
- Reply: Programmer Dude: "Re: empty dataset returned"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: 30 Oct 2003 07:24:12 -0800
Using Visual Studio.Net, Asp.Net, VB.Net:
I'm doing a search of datasets to see if a client alrady exists before
making a new entry. The problem is, if a match doesn't exist I
receive an error "System.IndexOutOfRangeException". How can I check
for the empty dataset and allow the process to continue without
generating an error? Here is my code:
daParentSearch.SelectCommand.Parameters("@LastName").Value =
txtLastName.Text
daParentSearch.SelectCommand.Parameters("@DOB").Value =
txtDOB.Text
daParentSearch.Fill(DsParentSearch1, "ParentalWaiver")
Dim tblParent As New DataTable
tblParent = DsParentSearch1.Tables("ParentalWaiver")
Dim rowParent As DataRow
rowParent = DsParentSearch1.Tables(0).Rows(0)
If "NotFound" Then (What is the proper syntax for this?)
Response.Redirect("NotFound.aspx")
Else
dgParentSearch.Visible = True
dgParentSearch.DataBind()
End If
End Sub
- Next message: Thomas Miller: "requirement: change users pswd at future pre-determined time wo storing in db - challenge"
- Previous message: Bill: "Re: SIMPLE algorithm that took me by surprise."
- Next in thread: Eric Veltman: "Re: empty dataset returned"
- Reply: Eric Veltman: "Re: empty dataset returned"
- Reply: Programmer Dude: "Re: empty dataset returned"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|