Wrox Programmer Forums
Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP.NET 1.0 and 1.1 > ASP.NET 1.0 and 1.1 Professional
| Search | Today's Posts | Mark Forums Read
ASP.NET 1.0 and 1.1 Professional For advanced ASP.NET 1.x coders. Beginning-level questions will be redirected to other forums. NOT for "classic" ASP 3 or the newer ASP.NET 2.0 and 3.5
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 1.0 and 1.1 Professional 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 March 12th, 2006, 02:43 AM
Authorized User
Join Date: Jul 2005
Location: new delhi, Delhi, India.
Posts: 12
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via AIM to kumar_raj13
Default How to check whether query retuns some rows or not

Hello All Friends,
I am raj from New Delhi,India.
I am Developing a WebSite on ASP.Net Platform.Now I am executing a sqlQuery
"Select uid from tablename where uid='" + txtuid.Text + "'"

I wanna check whether this Query returns result or returns blank.
I can do this with inserting records in DataTable and then counting the rows in DataTable.
But is there any other way of doing this without DataTable or DataSet.

Old March 13th, 2006, 12:59 AM
Friend of Wrox
Points: 4,332, Level: 27
Points: 4,332, Level: 27 Points: 4,332, Level: 27 Points: 4,332, Level: 27
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
Join Date: Nov 2003
Location: , NJ, USA.
Posts: 1,348
Thanks: 0
Thanked 5 Times in 5 Posts

What are you going to use to hold the data?

Before you actually run the query you can run another query like:
"Select Count(*) from tablename where uid='" + txtuid.Text + "'"

You can return the count into a variable and check if it is >0.


Similar Threads
Thread Thread Starter Forum Replies Last Post
Query on million of rows wkm1925 SQL Server 2000 6 October 23rd, 2006 09:30 AM
Query That Return 0 Rows in Results nimrod_r BOOK: Professional SQL Server Reporting Services ISBN: 0-7645-6878-7 0 June 5th, 2005 02:14 AM
getting a query rows as columns raamts SQL Language 1 February 24th, 2005 04:06 AM
Retreive 90th -100th rows from a query Ramanuj SQL Server 2000 4 December 1st, 2003 07:49 AM
Numeric Check in Query jepley Oracle 1 September 15th, 2003 03:59 PM

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