Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

RecordCount not working

Status
Not open for further replies.

rmz8

Programmer
Aug 24, 2000
210
US
I have a database with one record (named Site_Structure). Refer to the CFQUERY below:

<CFQUERY NAME=&quot;Assign_ID&quot; DATASOURCE=&quot;myjobcoach&quot; BLOCKFACTOR=&quot;100&quot;>SELECT * FROM Site_Structure</CFQUERY>

Here is how I implement RecordCount:

<CFOUTPUT><input type=&quot;text&quot; name=&quot;ID&quot; size=&quot;5&quot; value=&quot;#Val(Assign_ID.RecordCount + 1)#&quot;></CFOUTPUT>

In the input box, I use RecordCount to get how many records are in the database and then add one (so the next record's primary key ID follows the previous record's).

However, when I run the template, it returns a value of 6, when I am positive that there is only one record in the database, and thus the value should read 2! I checked the database to make sure that there is only one record--so how do I reset the DSN to reflect the changes in the database? [sig]<p>Ryan ;-]<br>[/sig]
 
might try value=&quot;#evaluate(Assign_ID.RecordCount +1)#&quot;

or try using <cfset holder = &quot;#evaluate(Assign_ID.Recordcount + 1)#&quot;>
value=&quot;#holder#&quot; [sig][/sig]
 
Hey Ryan...

Hum Zaz second solution is perfect but without the Evaluate... no need to use it:
<cfset holder = Assign_ID.Recordcount + 1>

value=&quot;#holder#&quot;

This will work perfectly...

Chris...

P.S.: Still thinking of a way to solve your problem in the other thread... I'm kinda out of idea right now...


[sig][/sig]
 
Thanks a lot guys--I found out however, that it wasn't my code, but rather a problem with my database. Please refer to 'Database record deletions not being made' for my new problem!

By the way, Chris, I fixed the previous problem by downloading the CF_Evaluate tage and tweaking it a little. Speed is unprecented and the integration was easy! Thanks for all your help on that manner. [sig]<p>Ryan ;-]<br>[/sig]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top