PDA

View Full Version : Newcomer in Delphi needs help



shamans
13-04-2005, 05:28 PM
Firstly i would like to say HI to a very lively community. As the title says i am new in the Delphi language and before starting writing games :? i decided to start palying with the IDE first. My question is simple (i am sure to most of you) and has a few sections.

I am trying to create a database with a table( I managed that). I want to link this table with a TDBGrid and a calendar (done that). This grid will be able to accept data chronologically. Here starts my question. How can i input a calendar like search and be able to acquire specific data by table or by date. To make it more clear if i have 5 items(S1,S2,S3,S3) under a column named "Items" and want to select only the last two S3s how can i do that? What if these two S3 have different entry dates and want to select them by date?

If it sounds confusing i apologise but i feel confused at the moment. I am still loking for the way while writing this and i hope i ll manage to find it before someone answers.
Thanks all for your time and once again glad to be part of PGD.

Shaman

Traveler
13-04-2005, 08:26 PM
I'm not entirely sure if I understand you correctly, but you can get data from a database using SQL.

In this case the SQL statement to get the required data would be something like:
Select * from <yourtablename>
where items = 'S3'

For this to work you need
TAdoConnection
TAdoQuery
TDataSource

In a nuttshell, create a new connection in the ADOConnection and set the connection property from ADOQuery to ADOConnection.
Then set the dataset property of TDatasource to ADOQuery and you're pretty much done. In ADOQuery there's a property SQL where you can place statements like the one above. Then use TDBGrid to display the data you want.

Hope this helps a bit.

Traveler
13-04-2005, 08:27 PM
Ahh shoot, where are my manners. :shock:

Welcome to PGD! :D

marmin
14-04-2005, 11:30 PM
Hi ! :wink: