From: Tobias G. <tob...@ca...> - 2004-04-07 12:15:53
|
Hello Peter, Using the FB .NET Provider with Delphis form designer is a mess... even in a winforms project you can't simply "click" a simple application together. Maybe that's not so bad, because it gives you the chance to write better code with a nice separated GUI ;) There are three ways of using the FB .NET Provider in Delphi with visual controls, I'm aware of: 1) Stick to WinForms... That's more or less the same as C#. 2) Use FbConnection / FbCommand / FbAdapter and fill your VCL Control, i.e. a TLixtBox by hand, using DataSet or DataReader. 3) Use FbConnection / FbCommand / FbAdapter and use TADONETConnector to connect a DataSet or DataTable to your data-aware VCL Controls like TDBGrid. A quick and dirty example for 3): On your form DBGrid1 is connected to DataSource1 and DataSource1 is connected to ADONETConnector1. Now you can do something like this: procedure TForm1.Button1Click(Sender: TObject); var Connection : FbConnection; Adapter : FbDataAdapter; empDataTable: DataTable; begin Connection := FbConnection.Create(FConnectionString); Connection.Open; try Adapter := FBDataAdapter.Create( 'SELECT EMP_NO, FIRST_NAME, LAST_NAME FROM employee', Connection); empDataTable := DataTable.Create('employee'); Adapter.Fill(empDataTable); ADoNetConnector1.DataTable := empDataTable; ADoNetConnector1.Active := True; finally Connection.Close; end; end; Tobias |