c++ builder 2007, query count record from database
Goodmorning
I have a simple application on C++Builder2007 and access 2007. I want to make a query so when a user hits a button to count the records on a specifiec date. I wrote the above but its not right. I want little help.
The fields are DATE->Date/Time Type... When i hit the button it says invalid integer.. I try to used the ADODATASET component but i dont have problem with that. Can i use something else;;;Like ADOQUERY. Wich is faster?
ADODataSet1->Active=false;
AnsiString query;
int MaxRecords=0;
query="SELECT Count (DATE) FROM DEYAS WHERE DATE= '" + Edit14->Text + "'";
ADODataSet1->CommandText="SELECT COUNT (DATE) FROM BILLS WHERE DATE= '" + Edit14->Text + "'" ;
ADODataSet1->Active=true;
Edit17->Text=IntToStr(MaxRecords);
Re: c++ builder 2007, query count record from database
What "invalid integer" do you men? It is not clear from your pseudo-code snippets.
Did you try to debug your code to see what exactly, when and how happens?
Re: c++ builder 2007, query count record from database
Hi. Sorry i thought i was clear. On Edit14->Text there is date with function DateToStr(Date());. I have these fields on database table.
A/A ->Automatic
Ammount->Float
Date->Date/Time with default value =Date()
So i want the user to hit the button and compare in the database with today date that have in edit14 and return the records.. For example 10 or 20. I dont know how to syntax right the query. How i syntax it first and then how i count it and return it on a new edit.
When it returns it says invalid integer. How i can see debugging sorry i am new in whole this
Re: c++ builder 2007, query count record from database
Quote:
Originally Posted by
Leite333
I dont know how to syntax right the query.
Then you must first learn the SQL documentation!
Quote:
Originally Posted by
Leite333
...
When it returns it says invalid integer. How i can see debugging sorry i am new in whole this
Then the second thing you must learn is the debugging in C++Builder2007. For example, read this doc: http://www.cs.armstrong.edu/liang/cp...veTeaching.pdf
Re: c++ builder 2007, query count record from database
Every time I to work with explicit SQL queries, first thing I do is checking the SQL syntax in some database client app. Only when I know that it's fully correct, I implement it in my code.