Solved

how to make dynamic adoquery?

Posted on 2002-04-28
2
232 Views
Last Modified: 2010-04-04
i am using adoconnection with access db
i have this code but does not work correct
to retrieve data from table
an any one help me?


procedure TForm1.Button3Click(Sender: TObject);
var l:integer;s:string;
begin
ADOQuery1.Close;
s:=edit1.Text;
ADOQuery1.SQL.Add('select Name, College from tabstd where Name=:s');
ADOQuery1.open;
end;
0
Comment
Question by:hass80
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 

Accepted Solution

by:
ZH-windmill earned 50 total points
ID: 6974592
following...
procedure TForm1.Button3Click(Sender: TObject);
var l:integer;s:string;
begin
ADOQuery1.Close;
s:=edit1.Text;
ADOQuery1.SQL.Clear; //1
ADOQuery1.SQL.Add('select Name, College from tabstd where Name=:s');
ADOQuery1.ParamybyName('s').value := ;//2
//or you may user the CreateParams function.
ADOQuery1.open;
end;

//i don't try it..
 
0
 
LVL 17

Expert Comment

by:geobul
ID: 6985759
Hi,

procedure TForm1.Button3Click(Sender: TObject);
begin
  ADOQuery1.Close;
  ADOQuery1.SQL.Clear;
  ADOQuery1.SQL.Add('select Name, College from tabstd where Name=:s');
  ADOQuery1.Parameters.ParamByName('s').value := edit1.Text;
  ADOQuery1.Open;
end;

Regadrs, Geo
0

Featured Post

[Live Webinar] The Cloud Skills Gap

As Cloud technologies come of age, business leaders grapple with the impact it has on their team's skills and the gap associated with the use of a cloud platform.

Join experts from 451 Research and Concerto Cloud Services on July 27th where we will examine fact and fiction.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

A lot of questions regard threads in Delphi.   One of the more specific questions is how to show progress of the thread.   Updating a progressbar from inside a thread is a mistake. A solution to this would be to send a synchronized message to the…
In my programming career I have only very rarely run into situations where operator overloading would be of any use in my work.  Normally those situations involved math with either overly large numbers (hundreds of thousands of digits or accuracy re…
Monitoring a network: why having a policy is the best policy? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the enormous benefits of having a policy-based approach when monitoring medium and large networks. Software utilized in this v…
Michael from AdRem Software explains how to view the most utilized and worst performing nodes in your network, by accessing the Top Charts view in NetCrunch network monitor (https://www.adremsoft.com/). Top Charts is a view in which you can set seve…
Suggested Courses
Course of the Month4 days, 21 hours left to enroll

636 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question