Link to home
Start Free TrialLog in
Avatar of JOHNHO
JOHNHO

asked on

how to print dbgrid data ?

like this,

the question is , how do we print the data that we has retrieave in  dbgrid control  by using sql in data control to be printed to the printer. lets say i succesfull retriave data  by using sql statement.

                      select xxxx from xxxx where xxxx = " xxx " and this showing some found data in the dbgrid which has been connected to data control.

                      so i want to print that data to printer .

                      how ?
ASKER CERTIFIED SOLUTION
Avatar of alesh
alesh

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of JOHNHO
JOHNHO

ASKER

ok if it like that.

so lets say im using crystal report, then how do i print the thing that i want to print.(not saying that i choose on the design
report ).

then what i mean that after i reatrive the data by using sql then that found data will go directly to crystal report. so how do i do it ?


 
Ok, if you would be using crystal report (CR) it's like this:
instead of retriving the data using sql in your application, you pass the sql string to the CR via the formula property.
For example:
cr.formula = "SELECT * FROM AUTHORS WHERE FirstName Like %John%"
cr.action 1 'tho i'm not sure about this line

And that's it, you design the report in CR almost the same way as you would design it in Access or a document in Word. By drawing it and putting fields on it.

CR will take care of everything else (considering the SQL string).

I hope this answered your question. If not please provide me back which part wasn't clear to you.

Best wishes,
Alesh
Avatar of JOHNHO

ASKER

it is cannot work.

it show me argument not optional.


I cannot give you step by step instructions how to make this. I answered your question how to do it and with what. I belive that should be enough to accept my answer!

Alesh