Select statement not working

Posted on 2006-04-20
Last Modified: 2010-05-18
Hello experts,

I am new to the Delphi/ so please bear with me. I an using Delphi 2006 and have a webfom with datagrid in it.  I am able to display data in the datagrid from a table but when I add a text box and try to display  only the records where table1.Field1 = TextBox.Text, I still get all the rows in the table.  Can u please let me know how I can fix the code below:

procedure TWebForm1.Button1_Click(sender: System.Object; e: System.EventArgs);
  EMPNo: String;
  command: BdpCommand;
  I : integer;

  bdpDataAdapter1.Active := False;
  command := BdpCommand.Create;
  command.Connection := bdpConnection1;
  command.CommandText := 'Select * FROM Table1  ' +
    'WHERE Field1 = ''' + textbox1.text+ '''';
     command.Executereader ;
    on E: Exception do
  bdpDataAdapter1.Active := True;
  dataGrid1.DataBind // refresh data

Question by:kalamoun
    LVL 13

    Accepted Solution

    you are never conecting the dataadapter to the command you are running

    Author Comment


    Featured Post

    Top 6 Sources for Identifying Threat Actor TTPs

    Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

    Join & Write a Comment

    Have you ever had your Delphi form/application just hanging while waiting for data to load? This is the article to read if you want to learn some things about adding threads for data loading in the background. First, I'll setup a general applica…
    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…
    Illustrator's Shape Builder tool will let you combine shapes visually and interactively. This video shows the Mac version, but the tool works the same way in Windows. To follow along with this video, you can draw your own shapes or download the file…
    Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

    755 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

    17 Experts available now in Live!

    Get 1:1 Help Now