[Gambas-user] Database error
Fabien Bodard
gambasfr at ...11...
Thu Jan 5 19:32:56 CET 2006
Le Jeudi 5 Janvier 2006 13:08, Ron Gottstein a écrit :
> 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
>
>
>
>
try to remove commit...
More information about the User
mailing list