Basic4ppc - Windows Mobile Development  

Go Back   Basic4ppc - Windows Mobile Development > Main Category > Code Samples & Tips
Home Register FAQ Members List Search Today's Posts Mark Forums Read

Code Samples & Tips Share your recent discoveries and ideas with other users.


Convert Any Database to SQLite (source & exe)


Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 05-26-2007, 02:48 PM
dzt's Avatar
dzt dzt is offline
Basic4ppc Veteran
 
Join Date: May 2007
Location: Greece
Posts: 353
Awards Showcase
Forum Contributer 
Total Awards: 1
Default Convert Any Database to SQLite (source & exe)

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
Attached Files
File Type: zip CSV2DL3.ZIP (336.0 KB, 247 views)
File Type: zip DB2CSV.zip (22.7 KB, 184 views)
__________________
Dimitris Zacharakis
http://www.terracom.gr

Last edited by dzt : 05-26-2007 at 03:54 PM.
Reply With Quote
  #2 (permalink)  
Old 06-05-2007, 11:47 AM
Junior Member
 
Join Date: May 2007
Posts: 37
Default

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.
Reply With Quote
  #3 (permalink)  
Old 01-02-2008, 02:59 PM
Junior Member
 
Join Date: May 2007
Posts: 26
Default 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
Reply With Quote
  #4 (permalink)  
Old 01-03-2008, 09:04 AM
dzt's Avatar
dzt dzt is offline
Basic4ppc Veteran
 
Join Date: May 2007
Location: Greece
Posts: 353
Awards Showcase
Forum Contributer 
Total Awards: 1
Default

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.
__________________
Dimitris Zacharakis
http://www.terracom.gr
Reply With Quote
  #5 (permalink)  
Old 01-04-2008, 07:28 AM
Junior Member
 
Join Date: May 2007
Posts: 26
Default

Thanks. I'll try that.
Reply With Quote
  #6 (permalink)  
Old 02-12-2008, 12:04 PM
Newbie
 
Join Date: Dec 2007
Posts: 2
Default To Create, Edit, Modify table and registers in sqlite 3 I recommend this...

A program for windows excellent. Is freeware at this moment:

SQLite Database Browser

http://sqlitebrowser.sourceforge.net/
Reply With Quote
  #7 (permalink)  
Old 02-28-2008, 07:39 AM
Junior Member
 
Join Date: May 2007
Posts: 26
Default

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
Reply With Quote
Reply



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
Date save as zero (0) in the SQLite database mozaharul Questions & Help Needed 2 04-02-2008 09:25 AM
Command to create a database in sqlite mozaharul Questions & Help Needed 5 03-30-2008 03:38 AM
How to combine table control and sqlite database mozaharul Questions & Help Needed 1 03-27-2008 12:10 PM
How to convert an Access database to a sqlite database Peter Code Samples & Tips 5 07-24-2007 03:20 PM
multiple connections to a sqlite database Peter Questions & Help Needed 5 05-13-2007 07:49 AM


All times are GMT. The time now is 04:23 AM.


Powered by vBulletin® Version 3.6.10
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.1.0