473,385 Members | 1,606 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.

Record counting in a database

66
Hey all,

i need to do a number of record counts on one table, for value matching a certain criteria,

to do for this page i have no database connection, recordset etc, i am a little confused where to start.

so basically i have a table of flights... and i want to show a table in asp stating that there are so many flights to london, so many flight to cardiff and so on...

please help!
Mar 11 '08 #1
1 1033
jasone
66
problem solved... used this nice bit of code, to select what i want to count

Expand|Select|Wrap|Line Numbers
  1. <% 
  2. Dim cn,cm 
  3. Set cn = Server.CreateObject("ADODB.Connection") 
  4. cn.Open "driver={Microsoft Access Driver (*.mdb)};dbq="& Server.MapPath("airlines.mdb") 
  5. set rs2=cn.execute ("Select count(*) as cardiffflights from tbl_flight_details WHERE arriving_airport ='cardiff'") 
  6. set rs=cn.execute ("Select count(*) as total from tbl_flight_details") 
  7. response.write "There are " & rs2("cardiffflights") & " flights landing in cardiff"
  8. response.write "There are " & rs("total") & " flights arriving"
  9. cn.close 
  10. Set cn = Nothing 
  11. Set rs = Nothing 
  12. %>
  13.  
  14.  
Mar 11 '08 #2

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

Similar topics

1
by: WindAndWaves | last post by:
Hey Folks I seem to be asking millions of questions. Truth is, I just discovered this awesome research and having been typing by myself for years the questions are all coming out. Here is...
6
by: 6thirty | last post by:
Hi, I've created a stocktaking database using Access XP. This is indexed by two fields - part number and shelf location. I am currently inputting all the data via a form. When I have entered a...
3
by: Megan | last post by:
hi everybody- i'm having a counting problem i hope you guys and gals could give me some help with. i have a query that retrieves a bevy of information from several different tables. first let...
20
by: Protoman | last post by:
OK, this code compiles, links, and executes, but, how do I setup, like, a spinlock to query the DataBase object's status to let the SmrtPtr know that the object's been deleted?: #pragma once ...
5
by: Clownfish | last post by:
I have a report that joins 12 external tables, and works great. However, there is a time when I wish to skip printing a particular record. Background: The 12 tables all have the same fields,...
21
by: jennwilson | last post by:
Ok - So, I am back. I would like to count the number of times a specific record appears in a field from one table in my query and then use that value in the same query to calculate an average....
25
by: tekctrl | last post by:
Anyone: I have a simple MSAccess DB which was created from an old ASCII flatfile. It works fine except for something that just started happening. I'll enter info in a record, save the record,...
2
by: dmne05974 | last post by:
As a novice in Access i am currently writing a database to track certain financial information for a non-profit organisation. As part of the funding they have to monitor age ranges and ethnic...
7
by: apank | last post by:
I have a form where I have a text box counting the # of characters. I am using the following code: Private Sub Goal1Comments_KeyDown(KeyCode As Integer, Shift As Integer) 'len counter for Goal 1...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

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.