User registration system: shows the minimum age among the users.
From: Ben (tungben_at_gmail.com)
Date: 03/17/05
- Next message: Santosh: "RE: SQL database"
- Previous message: Santosh: "Re: Mdac 2.7 Install Issue : INF Install failure"
- Next in thread: Val Mazur \(MVP\): "Re: User registration system: shows the minimum age among the users."
- Reply: Val Mazur \(MVP\): "Re: User registration system: shows the minimum age among the users."
- Messages sorted by: [ date ] [ thread ]
Date: 16 Mar 2005 18:47:51 -0800
I can't shows the minimum age among the users.
<%@ Language=VBScript %>
<% Option Explicit %>
<%
'-------------------------------------------------
'1. Open up a connection to our Access database
'-------------------------------------------------
Dim objConn
Set objConn = Server.CreateObject("ADODB.Connection")
objConn.ConnectionString ="DRIVER={Microsoft Access Driver
(*.mdb)};DBQ=C:\temp\open.mdb"
objConn.Open
'-------------------------------------------------
'2. Create a recordset object instance and retrieve the information
from the User table
'-------------------------------------------------
Dim objRS
Set objRs = objConn.Execute("SELECT * FROM user")
'----find min age and avg age------
Dim objMin
Set objMin = objconn.Execute("SELECT MIN(age) FROM user")
Response.Write objMIN("age")
'-------------------------------------------------
'3. Display the contents of the user table
'-------------------------------------------------
Do While Not objRS.EOF
Response.Write ("Name=")
Response.Write objRS("name") & ", "
Response.Write ("Age=")
Response.Write objRS("age") & ", "
Response.Write ("Sex=")
Response.Write objRS("sex") & ", "
Response.Write ("Id=")
Response.Write objRS("id")
Response.Write "<BR>"
objRS.MoveNext
Loop
Response.Write "====================================================="
'-------------------------------------------------
'4. Clean up our ADO objects
'-------------------------------------------------
objRS.Close
objConn.Close
Set objConn = Nothing
Set objRS = Nothing
%>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Our user database as following(open.dbm)
Name Age Sex id
AAA 30 M AAA30
BBB 20 M BBB20
CCC 10 M CCC10
DDD 20 F DDD20
EEE 30 F EEE30
- Next message: Santosh: "RE: SQL database"
- Previous message: Santosh: "Re: Mdac 2.7 Install Issue : INF Install failure"
- Next in thread: Val Mazur \(MVP\): "Re: User registration system: shows the minimum age among the users."
- Reply: Val Mazur \(MVP\): "Re: User registration system: shows the minimum age among the users."
- Messages sorted by: [ date ] [ thread ]