Wrox Programmer Forums
Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP.NET 1.0 and 1.1 > ASP.NET 1.1
|
ASP.NET 1.1 As of 10/6/2005, this forum is locked as part of the reorganization described here: http://p2p.wrox.com/topic.asp?TOPIC_ID=35394. No posts have been deleted. Open ongoing discussions from the last week have been moved to either ASP.NET 1.0 and 1.1 Beginners http://p2p.wrox.com/asp-net-1-0-1-1-basics-60/ or ASP.NET 1.0 and 1.1 Professional. http://p2p.wrox.com/forum.asp?FORUM_ID=50. See my sticky post inside for more.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 1.1 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 April 12th, 2005, 06:09 AM
Registered User
 
Join Date: Apr 2005
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default Getting around empty data sets

Hi all,

I'm new to ASP .NET and I know this would be a simple tasks in ASP but I have no idea how to do it in .NET


I have several stored procedures on a page producing datasets that are bound to label boxes on the page. Given the nature of the data, sometimes no results will come back from 1 or more of the stored procedures. When no results are returned, the application returns the error "Index 0 is not non-negative and below total rows count"

Is there a way I can trap for this so the page does not error out? Is there a way to continue with the execution of the page and just display nothing in the labels with empty datasets?


Thanks in advance.

Evan
 
Old April 12th, 2005, 01:21 PM
Friend of Wrox
 
Join Date: Nov 2003
Posts: 1,348
Thanks: 0
Thanked 5 Times in 5 Posts
Default

Try this:

IF ds.Tables(<tablename>).Rows.Count > 0 THEN
   Label.Databind
End If
 
Old April 13th, 2005, 06:01 AM
Registered User
 
Join Date: Apr 2005
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thanks. Nailed it!





Similar Threads
Thread Thread Starter Forum Replies Last Post
Union of Two data Sets tusharnarayan SQL Language 7 November 4th, 2008 05:23 PM
issue with data sets kaliaparijat ASP.NET 2.0 Professional 1 June 22nd, 2008 11:14 AM
using 2 sets of xml data from 1 xslt davepass XSLT 2 April 1st, 2005 06:31 PM
performance limits / data sets justinhume Pro PHP 1 July 15th, 2004 01:49 PM
How to calculate the number of XML data sets? zhao790 XML 4 October 29th, 2003 12:10 PM





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