I assume you mean a select query...let me know if I am wrong.
I dont do VBScript, so my example is in JScript but I the concept is the
same.
rs=DBConnect.Execute(strSQL);
//this returns a recordset object with the results of the SQL query
while (!rs.EOF) {
println(rs.fields("IPAddress").Value);
rs.moveNext();
}
//this loops through the recordset displaying the records
rs.close();
rs = null;
//this closes the db connection, which cfquery does automatically.
The CF equivalent to this is:
<cfquery name="rs" ...>
SELECT IPAddress ...
</cfquery>
<cfoutput query="rs">
#ipaddress#<br>
</cfoutput>
ADO database updates are a little different...
jon
Janine Jakim wrote:
>I'm looking at some vbs code and want to convert it to CF. I have most of
>it, however, am not quite sure about one spot.
>They use the line of code:
>
>Set orr=DBConnect.Execute(strSQL)
>DBConnect had been set to Creat connection to DB
>strSQL is the name of the query that they wrote.
>
>That makes sense to me. But then they set data fields and then to move to
>the next record they use
>orr.MoveNext
>I'm wondering if there is an equivalent in CF. I thought a loop query would
>do the trick but I'm not getting the results that I need.
>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Get the mailserver that powers this list at http://www.coolfusion.com
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Archives: http://www.mail-archive.com/[email protected]/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists