ColdFusion / Database / Running a query on Access
Snippet details
ID: 72
Viewed: 1469
Added: 2002-02-04
Version:
lets say the database is made up of two columns.... name and age.
name: age:
joe 29
Megan 21
bill 77
then you set up a .cfm page that runs a query against the database, AND outputs the results:
name: age:
joe 29
Megan 21
bill 77
then you set up a .cfm page that runs a query against the database, AND outputs the results:
General Details
Snippet uploaded by: snippet
Email : webmaster@snippetlibrary.com
Snippet By: Dr. Web
<!---Head--->
none
<!---Body--->
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Untitled</title>
</head>
<body>
<!--- query --->
<cfquery name="myStuff" datasource="wdbase" username="your username" password="the password">
select * from wdbase.dbo.tablename
</cfquery>
<table width=50%>
<tr>
<td><b>Name:</b></td>
<td><b>Age:</b></td>
</tr>
<!--- output from query --->
<cfoutput>
<!--- loop through every record returned in the query --->
<cfloop query="myStuff">
<tr>
<td>#myStuff.name#</td>
<td>#myStuff.age#</td>
</tr>
</cfloop>
<!--- after looping through all the results continue--->
</cfouput>
</table>
</body>
</html>
No Reviews to show
