Solved

how to make dynamic adoquery?

Posted on 2002-04-28
2
227 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

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

The uses clause is one of those things that just tends to grow and grow. Most of the time this is in the main form, as it's from this form that all others are called. If you have a big application (including many forms), the uses clause in the in…
Introduction The parallel port is a very commonly known port, it was widely used to connect a printer to the PC, if you look at the back of your computer, for those who don't have newer computers, there will be a port with 25 pins and a small print…

738 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