V4RB and sql question

Aaron Bratcher aaronbratcher at abdatatools.com
Mon Feb 16 14:37:14 CST 2004


Why is my insert command failing? It give me an error code of 1?  
Here's all the code:

   dim err as Integer
   dim vdb as vDatabase
   Dim dlg as SaveAsDialog
   dim outItem as FolderItem
   dim sql as string

   dlg=New SaveAsDialog
   dlg.promptText="starSecurity.rdb"
   dlg.Title="Create database file"
   outItem=dlg.ShowModal()
   If outItem = Nil then
     return
   End if

   Err = ValentinaInit( 5 * 1024 *1024, "", "")
   if Err <> 0 then
     MsgBox "Valentina engine error: " + Str(Err)
     quit
   end if


   vdb = new VDataBase

   if not vdb.Create(outItem,1,32) then
     MsgBox "error creating file"
     return
   end

   sql = "create table people (personid varchar, personname varchar, 
address varchar, city varchar, state varchar, zip varchar)"
   err = vdb.sqlExecute(sql)
   if err <> 0 then
     msgBox sql+chr(13)+str(err)
   end

   sql = "insert into people 
(personid,personname,address,city,state,zip) values('1','Robert 
Redford','','','','')"
// also tried this sql
//  sql = "insert into people (personid,personname) values('1','Robert 
Redford')"
   err = vdb.sqlExecute(sql)
   if err <> 0 then
     msgBox sql+chr(13)+str(err)
   end

--
Aaron Bratcher
ab DataTools
http://www.abDataTools.com



More information about the Valentina mailing list