Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

how to make dynamic adoquery?

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

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

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

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 I have seen many questions in this Delphi topic area where queries in threads are needed or suggested. I know bumped into a similar need. This article will address some of the concepts when dealing with a multithreaded delphi database…
In this brief tutorial Pawel from AdRem Software explains how you can quickly find out which services are running on your network, or what are the IP addresses of servers responsible for each service. Software used is freeware NetCrunch Tools (https…
We’ve all felt that sense of false security before—locking down external access to a database or component and feeling like we’ve done all we need to do to secure company data. But that feeling is fleeting. Attacks these days can happen in many w…
Suggested Courses

670 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