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

Select with WHERE statements

Status
Not open for further replies.

dmarnerou

Programmer
Jun 12, 2002
30
CY
Hi,
In a program I'm developing I have a screen in which I have a DBgrid with the information of images. Each image is connected to a person.
I have a field in which I want to write the patient number and then in the DBGrid to see all the images connected to that person
Any idea how I can do this?
Source code would be very helpful.

Thanks,
Demetra
 
Drop a SQL component on the form (maybe name qryImages) and a DataSource (dsImages), set the DataSet of dsImages to qryImages. In the SQL component set the SQL to:

Select image from table where patientid = :pID

(or something similar)

Then in the SQL component, go to Parameters and set the PID to the proper setting (string, integer, etc.)

in your code:

qryImages.ParamByName('PID').AsInteger := PatientID;
//if your patient ID is a string then the above should be AsString
qryImages.Active := True;

then set the DBGrid datasource to dsImages, and set up the column to the image field from the SQL statement.

HTH


Leslie
landrews@metrocourt.state.nm.us

There are 10 types of people in the world -
those who understand binary
and
those who don't!
 
You can also use the visual SQL-builder in the query component to construct your query, after that the SQL code should be visible.

Steven van Els
SAvanEls@cq-link.sr
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top