procedure TForm1.btnReadDataClick(Sender: TObject);
var
sql : String;
myConn : TFDConnection;
myQry : TFDQuery;
mySource : TDataSource;
myCursor : TFDGUIxWaitCursor ;
begin
// myCursor := TFDGUIxWaitCursor.Create(nil);
sql := ‘Select * From tpUsers‘;
myConn := TFDConnection.Create(nil);
myConn.ConnectionDefName := ‘TestMySQL‘;
myConn.LoginPrompt := false;
myConn.Open();
myQry := TFDQuery.Create(nil);
myQry.Connection := myConn;
myQry.SQL.Clear();
myQry.SQL.Text := sql;
myQry.Open();
mySource := TDataSource.Create(nil);
mySource.DataSet := myQry;
Self.dbgrd2.DataSource := mySource;
end;
时间: 2024-11-07 17:21:49