Programming Forums
User Name Password Register
 

RSS Feed
FORUM INDEX | TODAY'S POSTS | UNANSWERED THREADS | ADVANCED SEARCH

Reply
 
Thread Tools Display Modes
Old May 2nd, 2006, 7:44 AM   #1
wernervt
Newbie
 
Join Date: Mar 2006
Posts: 10
Rep Power: 0 wernervt is on a distinguished road
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
wernervt is offline   Reply With Quote
Old May 5th, 2006, 5:17 AM   #2
Christo
Newbie
 
Christo's Avatar
 
Join Date: May 2006
Location: South-Africa
Posts: 8
Rep Power: 0 Christo is on a distinguished road
Send a message via MSN to Christo Send a message via Yahoo to Christo
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!
Christo is offline   Reply With Quote
Old May 5th, 2006, 6:32 AM   #3
wernervt
Newbie
 
Join Date: Mar 2006
Posts: 10
Rep Power: 0 wernervt is on a distinguished road
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
wernervt is offline   Reply With Quote
Old May 5th, 2006, 8:55 AM   #4
Christo
Newbie
 
Christo's Avatar
 
Join Date: May 2006
Location: South-Africa
Posts: 8
Rep Power: 0 Christo is on a distinguished road
Send a message via MSN to Christo Send a message via Yahoo to Christo
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!
Christo is offline   Reply With Quote
Old May 5th, 2006, 2:38 PM   #5
Ooble
I eat cake for breakfast.
 
Ooble's Avatar
 
Join Date: Jul 2004
Location: In my box.
Posts: 4,434
Rep Power: 9 Ooble is on a distinguished road
Please don't post two threads for the same problem.
__________________
Me :: You :: Them
Ooble is offline   Reply With Quote
Old May 8th, 2006, 7:08 AM   #6
wernervt
Newbie
 
Join Date: Mar 2006
Posts: 10
Rep Power: 0 wernervt is on a distinguished road
sorry ooble. wnt do it again, i was just a bit desperate for advice. thanks
werner
wernervt is offline   Reply With Quote
Reply

Bookmarks

« Previous Thread in Forum | Next Thread in Forum »

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump




DaniWeb IT Discussion Community
All times are GMT -5. The time now is 1:19 AM.

Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC