Frequently Asked Component Specific Questions
Options |
Display all FAQ items |
Displaying items 1 to 1 of 1, page 1 of 1
<< previous next >>



How can I use a database component library for which no built-in interface component is provided in IntraWeb Query Builder?
You can use TatCustomDatabase component to manually retrieve tables and field names and pass the names to visual query component. Just drop a TatCustomDatabase component and set event handlers for all its events. The example below shows how to use TatCustomDatabase to support BDE components (although it is already supported by the specific TatBDEDatabase component). You must have a TDatabase component in the form named Database1 which points to the DBDEMOS database.
procedure TForm1.atCustomDatabase1ReadSqlPropertyEvent(ADataset: TDataSet; var ASQL: String); begin if ADataset is TQuery then ASQL := TQuery(ADataset).SQL.Text; end; procedure TForm1.atCustomDatabase1RetrieveFieldNameListEvent( const ATableName: String; const AList: TStrings); var table: TTable; c: integer; begin table:=TTable.Create(nil); try table.DatabaseName := 'DBDEMOS'; table.TableName := ATableName; table.FieldDefs.Update; for c := 0 to table.FieldDefs.Count-1 do AList.AddObject( table.FieldDefs[c].Name, // FieldName TObject(Ord(table.FieldDefs[c].DataType)) ); // DataType finally table.Free; end; end; procedure TForm1.atCustomDatabase1RetrieveTablenameListEvent( const AList: TStrings); begin Database1.GetTableNames(AList); end; procedure TForm1.atCustomDatabase1OpenQueryEvent(ASql: String; var ADataset: TDataSet); begin ADataset := TQuery.Create(Self); with TQuery(ADataset) do try DatabaseName := 'DBDEMOS'; Sql.Text := ASql; Open; except ADataset.Free; ADataset := nil; raise; end; end; procedure TForm1.atCustomDatabase1WriteSqlPropertyEvent(ADataset: TDataSet; ASql: String); begin if ADataset is TQuery then TQuery(ADataset).SQL.Text := ASQL; end;