Select statement not working

Hello experts,

I am new to the Delphi/ASP.net 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);
var
  EMPNo: String;
  command: BdpCommand;
  I : integer;
begin

  bdpDataAdapter1.Active := False;
  command := BdpCommand.Create;
  command.Connection := bdpConnection1;
  bdpConnection1.Open;
  command.CommandText := 'Select * FROM Table1  ' +
    'WHERE Field1 = ''' + textbox1.text+ '''';
  try
     command.Executereader ;
  except
    on E: Exception do
      Response.Write(E.Message)
  end;
  bdpDataAdapter1.Active := True;
  dataGrid1.DataBind // refresh data
end;


kalamounAsked:
Who is Participating?
 
BlackTigerXCommented:
you are never conecting the dataadapter to the command you are running
0
 
kalamounAuthor Commented:
Thanks
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.