Recent

Author Topic: Convert DBF to mysql  (Read 7403 times)

pjensen

  • New member
  • *
  • Posts: 7
Convert DBF to mysql
« on: July 25, 2007, 08:56:05 am »
Hi,

I am a newbie on lazarus-freepascal. But used TurbPascal years ago. :)

I want to play around with some database-applications.

Question: Is it possible on convert all *.dbf files which are contained in one directory automticly to a mysql 5.* database?

PS I am looking for a book for lerning freepascal and especially mysql. Any hints? (if possible a book in german language.)

Regards, Peter Jensen
OpenSuse 10.2 --- KDE --- Lazarus 0.9.22 beta with gtk1

Chris37

  • New Member
  • *
  • Posts: 15
    • http://lazarus-fr.espace-malin.fr/
RE: Convert DBF to mysql
« Reply #1 on: July 25, 2007, 12:13:24 pm »
Hello,

One methode !

1) Create your structure on your mysql database (its more)
2) In lazarus, open a query TDBF in reading to dbf files.
3) In lazarus, open a query (TSqlQuery with TMySql50Connection)
4) Parse and assign TDBFFields to TSQLQueryFields and post


Exemple:
TSqlQuery.Open
TDBFQuery.Open
TDBFQuery.first
while TDBFQuery.eof
  TSqlQuery.Edit
 
  TSqlQuery.FieldbyName('YourMySqlName').asstring:=TDbfQuery.FieldbyName('Yourdbfname').asstring
  ...(Other fields)


  TSqlQuery.Post

TDBFQuery.next
end;

 So, its not perfect but this function
 if that can help you !!

Sorry for my bad english !

Chris

pjensen

  • New member
  • *
  • Posts: 7
Convert DBF to mysql
« Reply #2 on: July 25, 2007, 08:51:29 pm »
Hi Chris,

thanks for reply.  Don't we have a tool for lazy idiots to do this job?  :wink:

OK  first i have to lern about mysql in lazarus.

Question: do you know where i can  find easy beginners exampales for using mysql 5 with lazarus?

Peter
OpenSuse 10.2 --- KDE --- Lazarus 0.9.22 beta with gtk1


pjensen

  • New member
  • *
  • Posts: 7
Convert DBF to mysql
« Reply #4 on: July 28, 2007, 08:53:33 pm »
Jap, thanks

that helped :=
OpenSuse 10.2 --- KDE --- Lazarus 0.9.22 beta with gtk1

 

TinyPortal © 2005-2018