Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

how to make dynamic adoquery?

Posted on 2002-04-28
2
Medium Priority
?
237 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
2 Comments
 

Accepted Solution

by:
ZH-windmill earned 100 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: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone 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

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…
In this tutorial I will show you how to use the Windows Speech API in Delphi. I will only cover basic functions such as text to speech and controlling the speed of the speech. SAPI Installation First you need to install the SAPI type library, th…
Integration Management Part 2
Are you ready to place your question in front of subject-matter experts for more timely responses? With the release of Priority Question, Premium Members, Team Accounts and Qualified Experts can now identify the emergent level of their issue, signal…
Suggested Courses
Course of the Month10 days, 11 hours left to enroll

886 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