Modifying tables

Ruslan Zasukhin sunshine at public.kherson.ua
Sat Nov 22 11:41:48 CST 2003


on 11/22/03 1:39 AM, jda at jda at his.com wrote:

> Hi all,
> 
> I have a table, "example", that I want to modify as I move my app to
> a new version. Here's my code:
> 
>    i = localFormatDB.SQLExecute("ALTER table example ADD user3 string(20)")
>    i = localFormatDB.SQLExecute("ALTER table example ADD user3style Blob(1)")
>    i = localFormatDB.SQLExecute("ALTER table example ADD user4 String(20)")
>    i = localFormatDB.SQLExecute("ALTER table example ADD user4style Blob(1)")
>    myCursor = new VCursor(localFormatDB, "select * from example
> where recID = 1", kServer, kReadWrite)
>    if myCursor <> nil then
>      myCursor.Field("user3").SetString("user3 information")
>      myCursor.Field("user4").setString("user4 information")
> 
>      result = myCursor.update
>      myCursor = nil
>   end if
> 
> Everything seems to go well, but when I try to use the data my app
> crashes. Looking at the cursor for, say, user3, the baseobject is set
> to Nil even after doing the update.
> 
> I'm obviously missing something. Anyone?

Jon,

First of all you need pay attention on property

    Vdatabase.SchemaVersion.

It is good idea in your open db function add code that check it,
If its version is 1 then
        open db
        modify structure
        change schemaversion to 2
        close db

open it again as version 2 db.


2) you DO NOT use classes in your project ?


-- 
Best regards,
Ruslan Zasukhin      [ I feel the need...the need for speed ]
-------------------------------------------------------------
e-mail: ruslan at paradigmasoft.com
web: http://www.paradigmasoft.com

To subscribe to the Valentina mail list go to:
http://lists.macserve.net/mailman/listinfo/valentina
-------------------------------------------------------------



More information about the Valentina mailing list