Well, Then you are going to like Coldfusion :) In ColdFusion.. it is much simpler(and less wordy).. more so then ASP because ColdFusion handles the details of the record set.
For example... lets say that you have a table called 'names' with two fields in it; FirstName and LastName. And the table lays out like this: LastName,FirstName { McNally,Jhon Gooble,Billy Pizza,Italian } To display all of those records.. would look something like this; -----------Snip------------- <!--- //Get Data from the Database ---> <cfquery datasource="Your_ColdFusion_Administrator_Datasource" name="What_ever_You_want_To_Name_It"> select * from names </cfquery> <!--- //Output the data ---> <cfoutput query="The_Name_Parameter_on_the_cfquery_statement"> #lastname#,#firstname# </cfoutput> ----------End Snip-------------- And ColdFusion handles everything else.. even down to incrementing the array position. Nice huh? Don't need to worry about arrays.. or initializing data objects.. or any of the ASP overhead. *grin* The Query field values are like an associative array.. for example.. if you want to access the the firstname field of a query you named "FirstnameLastname" (In the CFQUERY statement; <cfquery name="FirstnameLastname" datasource="Your_ColdFusion_Administrator_Datasource">) you would use the variable; FirstnameLastname.firstname (queryname.fieldname). Using the CFOUTPUT tag with the 'query' parameter also does something special.. It tells ColdFusion to <try> to preface your variables with the query (in the query parameter) you specified(unless you already have a regular variable by that name). So, using the cfoutput statement will reduce a variable like; #The_Name_Parameter_On_the_cfquery_statement.firstname#, to #firstname# within the open and close CFOUTPUT tag. In the example above, see how I didn't use the unimaginably long query name I specified? However, I could if I wanted to.. use #The_name_Parameter_on_the_cfquery_statement.lastname#,#The_Name_Parameter_O n_the_cfquery_statement.firstname#. *grin* but nobody would want to use that! ColdFusion automatically 'scopes' the variable to the query for you. Of course you'd want to put a <BR> or place table control tags to format the HTML, ex; (the cfquery tag stays the same) ---------Snip------------ <table> <cfoutput query="The_Name_Parameter_on_the_cfquery_statement"> <TR><TD>#lastname#,</td><td>#firstname#</td></tr> </cfoutput> </table> ---------End Snip--------- Also, ColdFusion populates certain values that you can use(but you have to reference with the 'queryname.' before.. For example: Coldfusion automatically populates the RecordCount value for the query. Tip: The Recordcount value is the number of rows returned in a query. So.. when you want to see how many records were returned from a query, use the variable, #queryname.recordcount#. Ex: you have a query named FirstnameLastname (from the table above) and you want to display the whole table.. AND make sure that if there is nothing in the table, you tell the user that 'there are no names in the table' instead of showing nothing. I'll also use the ColdFusion datasource on my server named,'customerdata'. ----------Snip----------- <cfquery datasource="customerdata" name="FirstnameLastname"> select * from names </cfquery> <cfif FirstnameLastname.RecordCount eq 0> <!--- //There aren't any records if RecordCount is 0 ---> <BR>There are no names in the table! <cfelse><!--- //The query returned records, Displaying them! ---> <cfoutput query="FirstnameLastname"> <BR>#Lastname#,#Firstname# </cfoutput> </cfif> ---------End Snip------------- Ex: To see if a UserName and password submitted is valid Table userinfo's fields: ID, UserName, Password { 1,'Dan','1234' 2,'Joseph','Z1Gzp-Vqr' 3,'Angus','Goober' ) The User submitted the form variables, 'User' for Username and 'pass' for password.(POST or GET.. ColdFusion deals with them seamlessly[ColdFusion even deals with URL parameters seamlessly, No Extra Code Needed to parse each type!]) ------------Snip-------------- <cfquery name="IsValidLogon" datasource="customerinfo"> SELECT ID FROM userinfo WHERE UserName = '#form.User#' AND Password = '#form.pass#' </cfquery> <cfif IsValidLogon.RecordCount neq 0> <!--- //RecordCount will be zero if no records and something else(nonzero) when there is records // TIP: the ' neq 0' part isn't really needed because the tags between the if branch will execute when Recordcount is // nonzero. That is, of course.. unless you are also testing for duplicate username and password combinations ---> Congratulations! You logged IN! <cfelse> invalid Username or password <cfinclude template="logon_form.cfm"><!--- Include the Login form in the execution ---> <cfabort><!--- Stop processing (after the login form is loaded)---> </cfif> -------End Snip--------- Warning.. the code above does a case-INsensitive match for most SQL distributions. If you wanted to do a case sensitive one.. you'd need to do include the username & password in the sql query and use the case sensitive Find function on the results to make sure they matched. An even better way.. is to store a hash of the password(<cfset passwordhash='#hash(form.pass)#'>) in the database instead of the actual password.. then compare the hashes. Good reading materials Mastering ColdFusion 4.5 by Arman Danesh and Kristin Aileen Motlagh(LOL, I learned most of what I know from this book, the samples in the CFServer, and playing with it) ColdFusion MX Web Application Construction Kit by Ben Forta(of which I know reads the cf-talk list) with Nate WeissLeon, Chalnick, and Angela Buraglia http://www.amazon.com/exec/obidos/tg/detail/-/0321125169/ref=lib_rd_ss_TFCV/ 102-4684305-1401754?v=glance&s=books&vi=reader&img=1#reader-link All In all.. good luck. And, get ready to accomplish things with less code ;). -DCO -----Original Message----- From: Scott Wilhelm [mailto:[EMAIL PROTECTED]] Sent: Monday, January 13, 2003 3:56 PM To: CF-Talk Subject: Database Results When I used to work with ASP, I would run my SQL statement, check to see if the recordset is empty or not, if it wasn't, I'd roll it up into an array, and the loop through the array. I know how to do the SQL statement, and how to loop through it, but how would I check to see if the result of the query contained results or not, and how would I put the results in an array, and then how would I loop through that array? I'm sorry for asking so many questions...I'm in a new job which is also a new developing environment...and I have very little time to learn all this... Any & all help is greatly appreciated, as I know everyone in here is strapped for time as well. Thanks, Scott ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~| Archives: http://www.houseoffusion.com/cf_lists/index.cfm?forumid=4 Subscription: http://www.houseoffusion.com/cf_lists/index.cfm?method=subscribe&forumid=4 FAQ: http://www.thenetprofits.co.uk/coldfusion/faq Your ad could be here. Monies from ads go to support these lists and provide more resources for the community. http://www.fusionauthority.com/ads.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4