Delphi Pages Forums  

Go Back   Delphi Pages Forums > Delphi Forum > DB-Aware

Lost Password?

Reply
 
Thread Tools Display Modes
  #1  
Old 05-17-2012, 01:00 PM
mbdelphi mbdelphi is offline
Junior Member
 
Join Date: Mar 2005
Posts: 12
Default Adoquery don't work (i think)

Hi

Ihave an AdoQuery with the following query:

Code:
select * from customers where name like :name
on a edit and speedbutton hi have

Code:
  ADOQuery1.Parameters.ParamByName('name').value := edit1.Text+'%';
  ADOQuery1.ExecSQL;
Why the adoquery don't make the query?

Thank's in advance.

Marco Branco

Last edited by mbdelphi; 05-17-2012 at 01:06 PM.
Reply With Quote
  #2  
Old 05-17-2012, 01:05 PM
mbdelphi mbdelphi is offline
Junior Member
 
Join Date: Mar 2005
Posts: 12
Default Any sugestion

I think that with this adoquery i can make many kind of filters, with multiple parameters.

Any sugestion?

Marco
Reply With Quote
  #3  
Old 05-21-2012, 08:12 AM
Norrit Norrit is offline
Moderator
 
Join Date: Aug 2001
Location: Landgraaf
Posts: 6,699
Default

ExecSQL isn't for select statements, you need Open
Reply With Quote
  #4  
Old 10-11-2012, 06:06 AM
kdalibor kdalibor is offline
Junior Member
 
Join Date: Jun 2012
Posts: 17
Default

Code:
  ADOQuery1.Parameters.ParamByName('name').value := edit1.Text+'%';
  ADOQuery1.ExecSQL;
Why not use SQL instead. Maybe something like this:

Quote:
ADOQuery1.DisableControls;
ADOQuery1.Close;
ADOQuery1.SQL.Clear;
ADOQuery1.SQL.Text:= 'SELECT * FROM Customers WHERE Name LIKE ' + QuotedStr(edit1.Text + '%');
ADOQuery1.EnableControls;
ADOQuery1.Open;
Reply With Quote
Reply

Tags
adoquery, query

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


All times are GMT. The time now is 05:11 AM.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2013, vBulletin Solutions, Inc.