![]() |
|
|||||||
|
|
Thread Tools | Search this Thread | Rate Thread |
|
#1
|
|||
|
|||
Hw to choose certain field in mysql input by user in visual C++/MFC and display in CRHi all,
I got one problem in displaying data from mysql in crystal report! the crystal report i used was version 8.0. As I know crystal report can display the data from database after setting manually! If I got a program doing in MFC which allow user to select to display certain period of the data by date, hw the crystal report know the string(date) choose by user and display it? What setting or sql query we need to do in crystal report? Thanks! |
|||
|
#2
|
||||
|
||||
Re: Hw to choose certain field in mysql input by user in visual C++/MFC and display in CRQuote:
Your question is strictly SQL. Say you have the table "errors" which contains the field "date_reported", and you wish to display the records in "errors" with "date_reported" between 10/3/2004 and 12/3/2005. Now, say the date is stored as the number of days from the year 0 (if the date is stored in another way you will have to do a conversion to simplify your work) then : " SELECT * FROM errors WHERE date_reported >= min_value and date_reported <= max_value " Now,don't change anything in the way you bind the data to your OCX, simply set the SQL string and call the method "your_data_control.refresh" (I believe it's called refresh but check this). Best regards, Kobi Hikri. __________________
It's actually a one time thing (it just happens alot). |
|
#3
|
|||
|
|||
Re: Hw to choose certain field in mysql input by user in visual C++/MFC and display in CRQuote:
Thanks but i dun knw whr should i put the method "your_data_control.refresh" and what u mean your_data_control? my program got one list box which user can select from what date to what date to report the data in Crystal Report! i cannot set the min_value and max_value bcos its should set by the user whn the program is running. so hw the Crystal report will know the min_value and max_value choose by user? |
|
#4
|
||||
|
||||
Re: Hw to choose certain field in mysql input by user in visual C++/MFC and display in CRQuote:
I understood what you did. After the user selects his "from" date and "untill" date, translate the dates to the format you store in the table. Then, set a variable to the min_value and another variable to the max_value. You can call them whatever names you wish, I used "min_value" and "max_value" unly to demontrate my point. Then build the SQL statement (You can use strcat to concatenate the parts of the SQL statement) and set your data control SQL string to the string you built.This is what I meant by "your_data_control" (Simply the name you gave the control you placed on your GUI). Then, call the refresh method to execute the SQL statement. If the control is binded correctly to a data display control (try using the flex data grid, it is very convenient to modify) then the data will be presented (perhaps you need to refresh the data display control too). Kobi Hikri. __________________
It's actually a one time thing (it just happens alot). |
|
#5
|
|||
|
|||
Re: Hw to choose certain field in mysql input by user in visual C++/MFC and display in CRThanks for ur kindly help!
i knw what u meant already! |
|
#6
|
||||
|
||||
Re: Hw to choose certain field in mysql input by user in visual C++/MFC and display in CRQuote:
Only tried to help, dude. No need to get angry. Be well, Kobi Hikri. __________________
It's actually a one time thing (it just happens alot). |
|
#7
|
|||
|
|||
Re: Hw to choose certain field in mysql input by user in visual C++/MFC and display in CRi am sincerely thanks for your help, really! Dun misunderstood!
if i let you felt i am angry, i would like to say sorry! Again, thanks! |
Recent GIDBlog
Vista ?Widgets? on Windows XP by LocalTech
| Thread Tools | Search this Thread |
| Rate This Thread | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Help! Some basal questions about MFC | xutingnjupt | MS Visual C++ / MFC Forum | 1 | 05-Dec-2004 03:38 |
Network Sites: GIDNetwork · GIDWebHosts · GIDSearch · Learning Journal by J de Silva, The