"Mike" <mike@notdisclosed!!.com> wrote in
news::
> Hi
>
> I've written my first asp.net page below. It queries an Access
> database with one table consisting of two columns - a username
> and a server name. The users enter their login name and the page
> queries the database and then directs them to the correct
> server. This works fine as long as their name actually exists in
> the database. If it doesn't the the page fails at the
>
> server = dataSet.Tables(0).Rows(0).Item(0).ToString()
>
> line saying row doesn't exist. My question is how can I handle
> this? If the usersname is not in the database I would then like
> the server string to be set to a predefined value such as
> 'noserver'.
Mike,
If dataSet.Tables(0).Rows.Count > 0 Then
Return dataSet.Tables(0).Rows(0).Item(0).ToString()
Else
Return "noserver"
End If
Hope this helps.
Chris.
-------------
C.R. Timmons Consulting, Inc.
http://www.crtimmonsinc.com/