Convert Any Database to SQLite (source & exe)

dzt

Active Member
Licensed User
Hello,

Here is an example of how to convert any database file, with OLEDB provider or ODBC driver, to SQLite, programmatically.

With a Command Line utility (DB2CSV, VB6 source and executable) you can run any SQL SELECT statement to any database and convert the result to CSV file.

After that you can convert the CSV file to SQLite database (CSV2SL3, BASIC4PPC source and executable)

This code is from a field service app I'm developping.

Attached are two zip files.
DB2CSV.ZIP: Visual Basic 6 source code and compiled app. Must have MDAC 2.8 installed and VB6 runtime files.
CSV2SL3.ZIP: Basic4PPC Source code and compiled app. Must have .NET 2.0 installed.

Regards,

Dimitris
 

Attachments

  • DB2CSV.zip
    22.7 KB · Views: 1,392
Last edited:

belotrei

Member
Code:
Con.CreateSQLTable ("Table1","mastertablename")

What is the syntax that needed to be added to the code above if i want to set the data type of certain column when making sql table?
Ex: i want to set "number" column to numeric.

So i don't have to reedit the data type of column anymore with third-party application.

Thanks.
 

tcgoh

Active Member
Licensed User
Longtime User
NullReferenceException

Hi Dzt,

Thanks for your above program and answering all the questions on SQL

However, when I try to compile your CSV2SL3 program to run on Device, it give me " NullReferenceException ". I have even included SQLDevice.dll in this folder with all your files.

I have run other SQL program(eg. SQL Viewer from Erel) without any problem. ie Net 2.0 is installed.

Thanks
TC
 

dzt

Active Member
Licensed User
Hi tcgoh,

Actually this program it was made to run on a desktop computer. To combile for PPC you need to:
1. Copy form C:\Program Files\Anywhere Software\Basic4ppc Desktop\Libraries SQLDesktop.DLL and SQLDevice.DLL.
2. Tools->Components->Device->Add DLL SQLDevice.DLL
3. Now it can compile

And copy to your device the produced EXE, SQLDevice.DLL and from C:\Program Files\Anywhere Software\Basic4ppc Desktop\Libraries\SQLNative\Device the System.Data.SQLite.DLL file.
 

tcgoh

Active Member
Licensed User
Longtime User
Hi dzt,

I'm trying to build a program with sl3. However, I face a few problems with data convertion, could you kindly point me to the right direction:

1. Your CSV2DLS3 is great, but it sometime give an error on the cmd line "DROP TABLE CUSTS"! (msg - no such table:custs) Can I use another code like clear table? or....

2. My data file comes from FoxPro, can FoxPro export to sl3 file? if so do I need additional drivers or special codes.

3. Can Basic4ppc work with sql data file or only with sl3?

Thanks and regards
TC
 

JMW

Member
Licensed User
Longtime User
Anyone know what happened to the second attachment? csv2sl3.zip
 
Top