Wrox Programmer Forums
Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP.NET 2.0 > ASP.NET 2.0 Basics
|
ASP.NET 2.0 Basics If you are new to ASP or ASP.NET programming with version 2.0, this is the forum to begin asking questions. Please also see the Visual Web Developer 2005 forum.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 2.0 Basics section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old August 25th, 2008, 09:59 PM
Friend of Wrox
 
Join Date: Oct 2005
Posts: 124
Thanks: 0
Thanked 1 Time in 1 Post
Default How to display 'Empty data' when fill datase

I am working on a VS2005/ASPnet 2.0 website. For a Sub BindDataGrid coding, I have coded the following lines to fill the dataset (ApptsDS)
for a GridView. These codes seem to be working fine if the dataset is not empty. Once in a while, the website stopped and we had an error
message for 'Timeout' server error.

1. How do I code to display a message indicating that 'currently there is no data available' when the dataset is empty? so that the website
     keeps running.
2. Is oErr.Message defined by VS2005 ASPnet 2.0? I don't remember how I got this code.

TIA,
Jeffrey
************************************************** ***************************

Dim DAAppts As New SqlDataAdapter(sSQL, oConnect)

Try
   DAAppts.Fill(ApptsDS)
   gvAppts.DataSource = ApptsDS
   gvAppts.DataBind()

Catch oErr As Exception
   lblErr.Text &= oErr.Message & "<br />"

Finally

  If oConnect.State <> ConnectionState.Closed Then
     oConnect.Close()

  End If
End Try

C. Jeffrey Wang
__________________
C. Jeffrey Wang
 
Old August 27th, 2008, 01:24 AM
Friend of Wrox
 
Join Date: Aug 2006
Posts: 231
Thanks: 0
Thanked 1 Time in 1 Post
Default

hey,

read this thred :

http://p2p.wrox.com/topic.asp?TOPIC_ID=67530


thanks......
 
Old August 28th, 2008, 11:57 PM
Friend of Wrox
 
Join Date: Oct 2005
Posts: 124
Thanks: 0
Thanked 1 Time in 1 Post
Default

Thanks for reminding what I have done in the .aspx file to display
the empty data lbl.text. Just figured out what's wrong with the query
codes for the dataset. This error caused several different error messages, e.g. Timeout Server error.

My 2nd question was to find the errors from the oErr.Message, but don't quite understand how to use it correctly. I have Googled and found
the information I need.

Anyway, I think I solved the problem. Thanks.





Similar Threads
Thread Thread Starter Forum Replies Last Post
how to fill the combobox with data from different alfiecrosby General .NET 0 May 14th, 2008 10:54 AM
How to Display an Empty DataGrid on Page Load jigsawcube1 General .NET 1 September 13th, 2007 10:00 PM
Fill data set from data reader sunil menghani ADO.NET 3 March 29th, 2005 07:08 AM
Fill Tree View Recursive And Display Right To Left favaedi BOOK: ASP.NET Website Programming Problem-Design-Solution 1 November 24th, 2004 02:36 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.