vCOM Create Table

Kirill Pekarov kirill_pekarov at valentina-db.com
Wed Dec 13 21:39:08 CST 2006


Hi, Brandon.

You wrote 13 декабря 2006 г., 23:10:09:

> Hmm, now it seems the code runs but no table is generated. Can someone test
> the sample code and see if it works? If it does then I will figure out what
> I am doing wrong.
First of all, you miss Db.InitLocal after "Dim Db As New VDataBase".

Next, we do not have such syntax like string(20, 'ASCII'). Try simple
string(20).

If you have problem, just enable the log "V.DebugLevel = EVDebugLevel.kLogFunctions"
Or you may use our methods for locate error (Db.ErrorNumber,
Db.ErrorString)

Also, you should look at our examples.


It is will work for you:
Private Sub Command1_Click()
  
  On Error GoTo ErrDb
    Dim V As New Valentina
    V.Init 9 * 1048576
    
    Dim Db As New VDatabase
    Db.InitLocal
    Db.Create "c:\sample.vdb"
    
    Dim sql As String
    sql = "CREATE TABLE tbl1 ("
    sql = sql + "fldString string(20) NOT NULL) "
    Db.SqlExecute sql
    Db.Close
        
    V.ShutDown
Exit Sub

ErrDb:
  MsgBox Str(Hex(mDatabase.ErrNumber)) + ": " + mDatabase.ErrString
End Sub


>>
>> Here is the test code:
>>       
>>     Dim V As New Valentina
>>     V.Init 10
>>     
>>     Dim Db As New VDataBase
>>     
>>     Db.Create "C:\temp\sample"
>>     
>>     Dim sql As String
>>     sql = "CREATE TABLE tbl1 ("
>>     sql = sql + "fldString string(20, 'ASCII') NOT NULL) "
>>     Debug.Print sql
>>     Db.SqlExecute sql
>>         
>>     V.ShutDown


-- 
With best regards
 Kirill                          mailto:kirill_pekarov at valentina-db.com



More information about the Valentina mailing list