Solved

how to make dynamic adoquery?

Posted on 2002-04-28
2
216 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 50 total points
Comment Utility
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
Comment Utility
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

Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
TcomboBox uninverted item 3 44
Delphi cmd execution 6 40
code issue 8 84
Printing problem 2 72
Objective: - This article will help user in how to convert their numeric value become words. How to use 1. You can copy this code in your Unit as function 2. than you can perform your function by type this code The Code   (CODE) The Im…
Introduction Raise your hands if you were as upset with FireMonkey as I was when I discovered that there was no TListview.  I use TListView in almost all of my applications I've written, and I was not going to compromise by resorting to TStringGrid…
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.

772 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

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now