[Gambas-user] Database error

Ron Gottstein mandrakeron at ...43...
Thu Jan 5 13:08:23 CET 2006


Hello All,

I amd using sqlite and sqlite3.
I've been trying to write some code to do simple
database operations.  I can create the database and
its table, however, i cant seem to insert any data
into the table.  I keep getting and error "Cannot
Create Record: Abort Due To Constraint Violation". 
Please advise.  Below is the code to insert the data.

Thank you,
Ron Gottstein


' Gambas class file
PUBLIC $hConn AS Connection
PUBLIC hTable AS Table
PUBLIC SUB btnCancel_Click()

 DIM rTest AS Result
 DIM sQuery AS String
 DIM iParam AS Integer
 iParam = 0
sQuery = "select * from Addresses where id = "
  INC Application.Busy
$hConn = NEW Connection

 WITH $hConn
   .Type = "sqlite"
   .Host = user.Home & "/gbAddressBook"
'
 END WITH
  $hConn.Name = "AddressBook"
  $hConn.Open
  $hConn.Begin

  rTest = $hConn.Create("Addresses")
  rTest!First_Name = tbFirstName.Text
  rTest Last_Name = tbLastName.Text
  rTest Street = tbStreet.Text
  rTest City = tbCity.Text
  rTest State = tbState.Text
  rTest Zip_Code = tbZipCode.Text
  rTest Home_Phone = tbHomePhone.Text
  rTest Work_Phone = tbWorkPhone.Text
  rTest Cell_Phone = tbCellPhone.Text
  rTest Email = tbEmail.Text
  rTest Birthday = tbBirthday.Text
  rTest.Update
  $hConn.Commit
END








		
__________________________________________ 
Yahoo! DSL – Something to write home about. 
Just $16.99/mo. or less. 
dsl.yahoo.com 





More information about the User mailing list