[V4RB] Copying one record to another Valentina DB

Wonder Fef wonderfef at noos.fr
Fri May 16 10:09:58 CDT 2003


> perhaps you could give a bit more info (code) so that we can see what
> needs improving ??

To give more details, the first database contains the main data of my
programm, and the second one runs like an archive.
Let's call them 'maindata.vdb' and 'archive.vdb'

All records deleted in the maindata.vdb are copied in the archive.vdb before
being deleted.

Dim cursor as Vcursor
Dim i as integer
Dim vbo as VBaseObject
Dim fieldName as string

Cursor = maindata.SQLSelect("SELECT * from myTable WHERE myBooleanField =
TRUE)

If cursor.recordcount = 0 then
    return
End if

'here I create the same BaseObject from maindata.vdb in archive.vdb if it
does not exist already.
'vbo then equals to the corresponding BaseObject in archive.vdb

For i = 1 to cursor.fieldcount
 'here I have code that detect if fields from maindata.vdb exist in
archive.vdb
 ' it creates fields if necessary
Next

///////// Now I copy the data from the cursor to archive.vdb
  do
    
    vbo.SetBlank
    
    for i = 1 to cursor.FieldCount
      
      fieldname = cursor.Field(i).Name
      
      vbo.field(fieldname).SetString(cursor.Field(fieldname).GetString)
      
    next
    
    vbo.AddRecord()
    
  loop until cursor.NextRecord = false


Thanks for your help
Eric



More information about the Valentina mailing list