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 SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Counting items in a column?

Status
Not open for further replies.

golyg

Programmer
Jul 22, 2002
319
0
0
US
In my app, I do not want the user to be able to enter a value if 5 values already exist.
On the 'Add' button, I have this:
/////////////////////////////////////////
SELECT Count(people)
INTO :num_people
FROM t_people
Where ((total_d = :in_total)
COMMIT;
if(num_people > 5) then
MessageBox(sg_msg)
else
OpenWithParm(wc_form_people_permission, TheItem )
end if
//////////////////////////////////////////////
But num_people is always = 0.

any ideas?

thanks
g
 
Hi,

I guess the problem most properly cause by the Where Clause. Is it the ":in_total" same as the people u want to count?(Is it a numeric?) What data is "total_d" stored? U may try to select * where total_d = :in_total by backdoor, see is there any rows return? If no rows, means no data attached to that criteria.

Hope this could help you to debug...
 
I also see a semi colon missing after your select query (i.e. before COMMIT) - that could also be causing the problem. In debug mode, check out the sqlca transaction object values to see if any problems with the query execution.
RT
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top