palmer ristevski <[EMAIL PROTECTED]> writes:

Hi Palmer,

> I am new to this type of Forum.Here is my question :
> My development platform is VB6. I am using "SQLitePlus
> COM-DLL" from ez-tools.com.They have code to access 
> and query an existing ".db" file, but I wish to know
> how to make a function call to create new SQLite 
> database files on harddisk.How would you do this using
> VB6?What is the function call that you would have to make.
> I know how to do this with SQLite at the command
> line, and I could use VB6 to execute these commands 
> at the command line, but I want a more direct way to create
> new database files.Hope someone can help me out.

Sorry, no experience with the SQLitePlus-COM-wrapper
(maybe you should ask their technical support).

In case you want to try out something, working 
similar to "ADO/DAO-style"...
The following example is Code for my COM-wrapper, 
which is available here:
www.datenhaus.de/Downloads/dhRichClientDemo.zip
It consists of three Binaries, placed in the 
Public Domain:
dhRichClient.dll (COM-Dll - ADO-like WrapperClasses)
sqlite35_engine.dll (StdCall-Dll, based on SQLite 3.5.7)
DirectCOM.dll (Std-Dll, allows regfree COM-instancing)

Small example how to use it, including the
creation of a new DB, in case the file doesn't
exists yet:

Dim Cnn As cConnection, Cmd As cCommand, Rs As cRecordset
Dim i As Long, FileName As String
  FileName = "c:\MyFile.db"

  Set Cnn = New cConnection 'create a Cnn-Object
  
  On Error Resume Next
    Cnn.OpenDB FileName 'attempt, to open a DB-file
    If Err Then 'DB-File doesn't exists... 
      Cnn.CreateNewDB FileName '...so we create one
    End If
  
  'Ok, let's create a table
  Cnn.Execute "Create Table If Not Exists " & _
              "Tbl(ID Integer Primary Key, Txt Text)"
  
  'now we insert a few records over a Command-Object
  Set Cmd = Cnn.CreateCommand("Insert Into Tbl Values(?,?)")
  For i = 1 To 5
    Cmd.SetText 2, "SomeText_" & i
    Cmd.Execute
  Next i
  
  'and finally we request a Resultset...
  Set Rs = Cnn.OpenRecordset("Select * From Tbl")

  Do Until Rs.EOF 'loop over it...
    Debug.Print Rs!ID, Rs!Txt '...and print its contents
    Rs.MoveNext
  Loop


Olaf Schmidt



_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to