![]() |
|
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Newbie
Join Date: Mar 2006
Posts: 10
Rep Power: 0
![]() |
Connecting sql
I have unsucessfully tried to query my database using an query
component under the bde tab in delphi 7. Basicly i want to filter the databse in three sections to pin point it to a specific date range and a rep name (a field in the database) So this is the basic layout: Database name : Query.dbf Field name of date : QOUTEDATE The rep name field: REPNAME so i use bde and i would like to filter the data 1st between a from date (field QOUTEDATE) and an to date (also on the same field QOUTEDATE) Then 2nd i want to filter those dates to only show the following rep name (field REPNAME) Within that date range. i have a datetimepicker wich adds the dates into edit1 and edit 2 boxes. I want the query1 to filter the dates using the text inside the edit 1&2 boxes. This is whot i did: Button 17.click: (filters the whole thing by excecuting the query1 component. procedure TForm14.Button17Click(Sender: TObject); begin Query1.ParamByName('qoutedate1').AsString := edit1.Text; Query1.ParamByName('qoutedate2').AsString := edit2.Text; Query1.ParamByName('repname').AsString := edit3.Text; Query1.Prepare(); query1.ExecSQL; end; SQL Statement in query1 component.: Select * from Query where QOUTEDATE >= :qoutedate1 and QOUTEDATE <= :qoutedate2 and repname = :repname i have also set the parameters inside the query component. It tells me that it cannot preform the operation on an open dataset. Does any one have a solution to what i would like to do here? i am in a situation where i need to get this right in a matter of a short time. I would really appreciate any help here. Thank you Werner |
|
|
|
|
|
#2 |
|
Newbie
|
I've asked around and why not try this :
procedure TForm14.Button17Click(Sender: TObject); begin Query1.Close; Query1.ParamByName('qoutedate1').AsString := edit1.Text; Query1.ParamByName('qoutedate2').AsString := edit2.Text; Query1.ParamByName('repname').AsString := edit3.Text; Query1.Prepare(); Query1.Open; end;
__________________
Forgive me if I ask Stupid Questions, to you it may be stupid but to me it's something I want to find out! So Please bear with me and help me out! Thank you! |
|
|
|
|
|
#3 |
|
Newbie
Join Date: Mar 2006
Posts: 10
Rep Power: 0
![]() |
This seems to work ! Thank you so much for your help! Where did you get the advice from? Keep in touch.I am just a begginer but i need advice from time 2 time.
Werner |
|
|
|
|
|
#4 |
|
Newbie
|
I know a few stuff about Delphi its just I didn't think off this, but when my friend showed me I clicked and I figured it out too! But ask anything I'll help you!
__________________
Forgive me if I ask Stupid Questions, to you it may be stupid but to me it's something I want to find out! So Please bear with me and help me out! Thank you! |
|
|
|
|
|
#5 |
|
I eat cake for breakfast.
![]() ![]() ![]() ![]() Join Date: Jul 2004
Location: In my box.
Posts: 4,434
Rep Power: 9
![]() |
Please don't post two threads for the same problem.
|
|
|
|
|
|
#6 |
|
Newbie
Join Date: Mar 2006
Posts: 10
Rep Power: 0
![]() |
sorry ooble. wnt do it again, i was just a bit desperate for advice. thanks
werner |
|
|
|
![]() |
| Bookmarks |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|