Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Export MySql query to DBase table

Status
Not open for further replies.

BlackDice

Programmer
Mar 1, 2004
257
US
Need help using a TBatchMove object to export the results of a query from a MySql database to a Dbase table

bdiamond
 
TBatchMove works with BDE datasets and not with Querys. So I don't think you can do what you want to do with TBatchMove.

Andrew
Hampshire, UK
 
Okay, even with the dataset I still need a little help here. Even using the dataset I get a 'Invalid parameters for TBatchMove object' or something like that. I think I'm missing something, but I can't figure out what it is. Thanks in advance

bdiamond
 
I need a little help too.

Which version of Delphi have you got?

How are you accessing your MySQL table?

What properties have you set in your TBatchMove object ?



Andrew
Hampshire, UK
 
I'm using Delphi 5. I've had a few different things. I'm using MySQLDac to access the data in a query. This is what I have right now, though:

procedure TForm_qm_SQL.Btn_ExportDBFClick(Sender: TObject);
var
//oExport: TmySQLQuery;
oExport: TQuery;
tblDest: TTable;
tblSource: TTable;
begin

Screen.Cursor := crHourglass;
//tblExportDBF.DatabaseName := 'QM_Database';
//oExport.DataSource := QueryResults.DataSource;
with tblExportDBF do
begin
Active := False;
FieldDefs.Clear;

TableType := DBTables.ttDBase;
FieldDefs := DataSource_query.DataSet.FieldDefs;
IndexDefs.Clear;
CreateTable;
Active := True;
end;

//tblSource.DataSource := ;
BatchMoveExport.Destination := tblExportDBF;
BatchMoveExport.Source := oExport ;

BatchMoveExport.Execute;

tblExportDBF.Active := False; {close the new DBase table}
Screen.Cursor := crDefault;
ShowMessage('Successfully exported ' + IntToStr(BatchMoveExport.MovedCount) + ' records to c:\CRL_Export.dbf with ' + IntToStr(BatchMoveExport.ProblemCount) + ' errors.');
exit;
end;
end.

bdiamond
 
I've not used MySQLDac but I suspect it is not a BDE Dataset.


Andrew
Hampshire, UK
 
it's not, but I'm still trying to find out how to do it even with the BDE dataset

bdiamond
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top