procedure TForm1.FormCreate(Sender: TObject);
var
adoconn:TADOConnection;
adoquery:TAdoquery;
begin
adoconn:=TADOConnection.create(Application);
adoconn.ConnectionString:='Provider=SQLOLEDB.1;Persist Security Info=False;User ID=sa;Initial Catalog=Tablesname;Data Source=SQL SERVER NAME';
adoconn.Open;
adoquery:=TAdoquyer.create(Application);
adoquery.Connection:=adoconn;
adoquery.Close;
adoquery.SQL.Clear;
adoquery.SQL.Add('select * from a');
adoquery.Open;
end;
end.