If performance is not an issue you could use the cfobject or cfscript tag
to create an ADO connection. I have done this with an access mdb eg:
<html>
<head>
<title>Use cfscript to connect to a DB</title>
</head>
<body>
<CFSCRIPT>
/* reference
http://www.cfcomet.com/Other/index.cfm?ArticleID=06FD4678-575F-46C9-8BEEA9D83CCC7F4E*/
/* Set variables for establishing the ODBC connection (change to your
values) */
Provider="Microsoft.Jet.OLEDB.4.0"; //Database provider type
DataBasePath=ExpandPath("gameonline.mdb"); // Database location
Datasource="Provider=#Provider#;Data Source=#DataBasePath#";
UserName = ""; // Username (if applicable)
Password = ""; // Password (if applicable)
/* The SQL to run. Modify to suit your needs*/
strSQL = "SELECT productID, productName,image FROM products ORDER BY
productName ASC";
// Define ADO Constants
adOpenStatic = 3;
adLockReadOnly=1;
adCmdTxt = 1;
adGetRowsRest = -1;
/* Create the ADO Connection object and open a new connection to the
datasource */
objDataConn = CreateObject("COM", "ADODB.Connection");
objDataConn.Open(Datasource, UserName, Password, -1);
objDataRst = CreateObject("COM", "ADODB.Recordset");
objDataRst.open(strSQL, objDataConn, adOpenStatic, adLockReadOnly,
adCmdTxt);
/* Get the field names*/
strFieldNames = objDataRST.Fields;
/* Get the recordcount of the recordset*/
intRecordCount = objDataRst.RecordCount;
arrRst = objDataRst.GetRows(adGetRowsRest);
objDataRST.close();
</CFSCRIPT>
<cfset columnCount=0>
<TABLE BORDER=1>
<TR>
<CFLOOP COLLECTION="#strFieldNames#" ITEM="this">
<TH bgcolor="#CC99FF"><CFOUTPUT>#this.name#</CFOUTPUT></TH>
<cfset columnCount=columnCount + 1>
</CFLOOP>
</TR>
<!---Loop through the rows --->
<CFLOOP FROM="1" TO="#intRecordcount#" INDEX="intRow">
<TR>
<!--Loop through the columns --->
<CFLOOP FROM="1" TO="#columnCount#" INDEX="intColumn">
<td valign="top">
<!--- If the field is NULL it causes an error to get around this I capture any errors
and continue then replace with a space for that field value.
--->
<cftry>
<CFOUTPUT>#trim(arrRst[intColumn][intRow])#</CFOUTPUT>
<cfcatch type="Any">
</cfcatch>
</cftry>
</TD>
</CFLOOP>
</TR>
</CFLOOP>
</TABLE>
</body>
</html>
I hope this helps
Warren
---
You are currently subscribed to cfaussie as: [email protected]
To unsubscribe send a blank email to [EMAIL PROTECTED]
MX Downunder AsiaPac DevCon - http://mxdu.com/