RE: newbie wants to access by rows and columns
technically, you can't do this. some other people have suggested solutions that will give you a close approximation of "the second row". the problem (there is no fault with the suggestions or code) is that the concept of "the second row" is not a constant. because of the way RDBMS systems work, there is no way to *guarantee*, *every single time* that the "second row" will be the "second row". the data "lives" out in database land, and is returned in sets. just because something is the second row one time you query for * from the DB, there is no hard and fast guarantee that it will be the second row the next time. this is especially true for SQL server and Oracle (IOW, the more "powerful" DBMSs.) chris olive, cio cresco technologies [EMAIL PROTECTED] http://www.crescotech.com -Original Message- From: Roadrunner [mailto:[EMAIL PROTECTED]] Sent: Monday, March 19, 2001 9:48 PM To: CF-Talk Subject: newbie wants to access by rows and columns Yes, Lee I want to access fields by rows and columns. Exactly. If it is more advanced which you state it is, what topic would I look under in a Cold Fusion book. I've abused everyone's talents enough for one evening. I'm willing to go out and study this on my own. I just need direction. Thanks, Greg -Original Message- From: BORKMAN Lee [mailto:[EMAIL PROTECTED]] Sent: Monday, March 19, 2001 9:38 PM To: CF-Talk Subject: RE: Thanks everyone but one last question Do you really want to see what's in row 2, column 2, or do you want to see what ID(3)'s First Name is? That seems much more useful. To do that you just use SELECT FirstName from TableName WHERE ID = 3 #test.firstname# If you really want to access fields by row and column number, there are a number of ways, all of them slightly more advanced, but I doubt that's actually what you want. Let us know, thanks Leeb. -Original Message- From: Roadrunner [mailto:[EMAIL PROTECTED]] .. See the database setup below. ID PASSWORD FIRSTNAME LASTNAME 4 sdf greg landry 3 gth tom jones Lets say I wanted to see what is in the second record and see what's under the column FIRSTNAME. What I am learning is that I have to print out the entire database to see what is in it. I would just like to be able to know how to access a particular element in a database. Like what's in row 2, column 2? IMPORTANT NOTICE: This e-mail and any attachment to it is intended only to be read or used by the named addressee. It is confidential and may contain legally privileged information. No confidentiality or privilege is waived or lost by any mistaken transmission to you. If you receive this e-mail in error, please immediately delete it from your system and notify the sender. You must not disclose, copy or use any part of this e-mail if you are not the intended recipient. The RTA is not responsible for any unauthorised alterations to this e-mail or attachment to it. ~~ Structure your ColdFusion code with Fusebox. Get the official book at http://www.fusionauthority.com/bkinfo.cfm Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/ Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists
RE: newbie wants to access by rows and columns
You have to look at it this way, a query will only return what you ask it to return. So without knowing what you want you can really only return the entire list... Now having said this, if you did return the entire list from the DB. You know how many records there are because of the RecordCount. So depending on what your thinking here, you could turn the query into an array and reference it this way. Or you could just do an output like this. #fieldname# The problem with the query tag is that you need to know what you wish to return, and unless you have something to identify the row it can't be done. -Original Message- From: Roadrunner [mailto:[EMAIL PROTECTED]] Sent: Tuesday, 20 March 2001 1:48 PM To: CF-Talk Subject: newbie wants to access by rows and columns Yes, Lee I want to access fields by rows and columns. Exactly. If it is more advanced which you state it is, what topic would I look under in a Cold Fusion book. I've abused everyone's talents enough for one evening. I'm willing to go out and study this on my own. I just need direction. Thanks, Greg -Original Message- From: BORKMAN Lee [mailto:[EMAIL PROTECTED]] Sent: Monday, March 19, 2001 9:38 PM To: CF-Talk Subject: RE: Thanks everyone but one last question Do you really want to see what's in row 2, column 2, or do you want to see what ID(3)'s First Name is? That seems much more useful. To do that you just use SELECT FirstName from TableName WHERE ID = 3 #test.firstname# If you really want to access fields by row and column number, there are a number of ways, all of them slightly more advanced, but I doubt that's actually what you want. Let us know, thanks Leeb. -Original Message- From: Roadrunner [mailto:[EMAIL PROTECTED]] .. See the database setup below. ID PASSWORD FIRSTNAME LASTNAME 4 sdf greg landry 3 gth tom jones Lets say I wanted to see what is in the second record and see what's under the column FIRSTNAME. What I am learning is that I have to print out the entire database to see what is in it. I would just like to be able to know how to access a particular element in a database. Like what's in row 2, column 2? IMPORTANT NOTICE: This e-mail and any attachment to it is intended only to be read or used by the named addressee. It is confidential and may contain legally privileged information. No confidentiality or privilege is waived or lost by any mistaken transmission to you. If you receive this e-mail in error, please immediately delete it from your system and notify the sender. You must not disclose, copy or use any part of this e-mail if you are not the intended recipient. The RTA is not responsible for any unauthorised alterations to this e-mail or attachment to it. ~~ Structure your ColdFusion code with Fusebox. Get the official book at http://www.fusionauthority.com/bkinfo.cfm Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/ Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists
RE: newbie wants to access by rows and columns
Well, there are several ways you could go: - Run the query to grab the entire table. Then reference the query as though it's a CF-structure; or - Run the query using STARTROW=2 and MAXROWS=1 to stop at row 2, then use queryname.columnlist, listgetat(), and evaluate() to fetch the data from column 2; I'm sure there are other and/or better ways. You could slurp the whole query into a 2-d array, and do your references directly. But I'm sure you don't want us to give away the whole thing ;-) What fun would that be? best of luck, LBB -Original Message- From: Roadrunner [mailto:[EMAIL PROTECTED]] Yes, Lee I want to access fields by rows and columns. Exactly. If it is more advanced which you state it is, what topic would I look under in a Cold Fusion book. I've abused everyone's talents enough for one evening. I'm willing to go out and study this on my own. I just need direction. how to access a particular element in a database. Like what's in row 2, column 2? IMPORTANT NOTICE: This e-mail and any attachment to it is intended only to be read or used by the named addressee. It is confidential and may contain legally privileged information. No confidentiality or privilege is waived or lost by any mistaken transmission to you. If you receive this e-mail in error, please immediately delete it from your system and notify the sender. You must not disclose, copy or use any part of this e-mail if you are not the intended recipient. The RTA is not responsible for any unauthorised alterations to this e-mail or attachment to it. ~~ Structure your ColdFusion code with Fusebox. Get the official book at http://www.fusionauthority.com/bkinfo.cfm Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/ Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists