473,385 Members | 1,824 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

How to read the results of a "Count" query

I'm working in visual web developer and i want to use the results of a count query but i don't know how to get them. I am using a select statment:

SELECT Count(Record) From " & Session("Customer")

And I believe that works, but now i don't know how to actually look at or use the count. I thought i could just use the reader so i tried:

Session("Count") = dbreader.Item("Count(Record)")

but that doesn't work. I feel like i just have the syntax wrong, but i could be further off than that.

Thanks in advance
Jun 27 '07 #1
2 1272
nateraaaa
663 Expert 512MB
I'm working in visual web developer and i want to use the results of a count query but i don't know how to get them. I am using a select statment:

SELECT Count(Record) From " & Session("Customer")

And I believe that works, but now i don't know how to actually look at or use the count. I thought i could just use the reader so i tried:

Session("Count") = dbreader.Item("Count(Record)")

but that doesn't work. I feel like i just have the syntax wrong, but i could be further off than that.

Thanks in advance
Try using the ExecuteScalar() method to get this value. Then save this value as a Session variable. Hopefully this gets you on track.

Nathan
Jun 27 '07 #2
Paulson
63
Try using the ExecuteScalar() method to get this value. Then save this value as a Session variable. Hopefully this gets you on track.

Nathan
Try as Nateraa said
Try like this --> give a name for count
SELECT Count(Record) as RecordNumber From " & Session("Customer")
and try to access that name (ie RecordNumber in this case )
Check out and reply if this helps.Good Luck.

bye Paulson.
Jun 28 '07 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: James | last post by:
Access 2003, trying to count the number of records that meet a criteria. According to Help: "In the Database window, click Queries under Objects, and then click New on the database window...
3
by: Rabun | last post by:
Heres one that is giving me fits ( = = Access newbie), more than likely something simple that I blew right over . . . any help is appreciated - I have a report based on a query, with several...
0
by: chris.bender | last post by:
1. My problem: I am using a query to populate a Chart in MS Access 2k. 2. My query: SELECT .Status, ., Sum(.Amount) AS SumOfAmount, Sum(IIf(!="Debit",!,!*-1)) AS realAmount, Count(.Status) AS...
1
by: Greg Smith | last post by:
I am trying to write a SQL query that will return a record count to my C# application. I wrote the following query: ALTER PROCEDURE up_justification_duplicate AS SELECT COUNT(*) FROM...
1
by: AJ | last post by:
Hi all, I have the following data: AnswerID SubmitID AnswerQuestion OptionSelected 0001 1 1 1 0002 1 1 ...
3
by: Jennifer | last post by:
I have a table that I am trying to do a query on. Table is named GPFCount2. CREATE TABLE ( NULL , NULL , NULL , NULL , NULL ,
1
lwwhite
by: lwwhite | last post by:
When a user clicks OK on form "SelectDefaults," I want to open form "Welcome" if the results of query "qry_todo_overdue" = 0 or form "OverdueToDo" if the results >= 1. First, I assume that I need to...
3
WyvsEyeView
by: WyvsEyeView | last post by:
This seems like it should be so easy to do. I have a table, called tblTopics. Each topic can have one or more instances, contained in a table called tblTopicInst. tblTopics is bound to a form called...
5
by: gflor16 | last post by:
Problem: I have this code to run a word counter. But I have a problem when I hit the enter key, it doesn't give me any output of how many chars or words. ''' <summary> ''' Returns Word...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.