Wrox Programmer Forums
|
ADO.NET For discussion about ADO.NET.  Topics such as question regarding the System.Data namespace are appropriate.  Questions specific to a particular application should be posted in a forum specific to the application .
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ADO.NET 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 September 28th, 2004, 05:28 AM
Authorized User
 
Join Date: Sep 2004
Posts: 14
Thanks: 0
Thanked 0 Times in 0 Posts
Default Count

Hi:

im developing a VB.NET web application. i want to creat a count button which will count the total # of records displayed in a datagrid ( the datagrid may be on a number of pages so it should count the total). The code i came up with is as follows:

Dim sqlCount As String
Dim reader As OleDb.OleDbDataReader

Try

sqlCount = "Select count (code) from area"

obj.Query = sqlCount
reader = obj.returnReader

If (IsDBNull(reader.Item(0))) = True Then
lblCount.Text = "0 records returned"

Else
blCount.Text = reader.Item(0) & " records"
End If

Catch exception As Exception
lblCount.Text = "0"
lblComment.Text = "No records returned"

Finally
reader.Close()

it doesnt read the "(If (IsDBNull(reader.Item(0))) = True Then" statement. it jumps to the exception. therefore, i think the problem lies between those lines.

please help.
Thanks
 
Old September 28th, 2004, 05:33 AM
Friend of Wrox
 
Join Date: Jun 2004
Posts: 449
Thanks: 0
Thanked 1 Time in 1 Post
Send a message via MSN to r_ganesh76
Default

You can do that by getting the count from the datasource assigned to the datagrid

Regards
Ganesh
 
Old September 28th, 2004, 08:06 AM
Registered User
 
Join Date: Sep 2004
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts
Default

go for rows.count property

 
Old September 19th, 2010, 07:08 AM
Registered User
 
Join Date: Sep 2010
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default howhow to count negative and positive numbers stored in array

hello
i really need to know how to count negative and positive numbers stored in array ,even i do not know whats their specific function
I am beginner in Assmbly language and this is the first time i want to write program so please help me
it would be a world to me
thanks
best regards
 
Old September 20th, 2010, 03:47 AM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 996
Thanks: 2
Thanked 11 Times in 11 Posts
Send a message via Yahoo to melvik
Default

make a forEach look & then compare if its -/+ then do counting
__________________
Always,
Hovik Melkomian.





Similar Threads
Thread Thread Starter Forum Replies Last Post
XSL: Count = Count + 1 elayaraja.s XSLT 3 July 18th, 2008 03:21 AM
is there any in built function to count page count g.tamilselvan MySQL 1 February 15th, 2006 07:43 AM
Need Count Help ~Bean~ SQL Language 11 August 9th, 2005 11:22 PM
Count, sum, count a value, return records CongoGrey Access 1 April 18th, 2005 02:25 PM
count() crmpicco MySQL 1 January 28th, 2005 01:44 PM





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