• Welcome to SQLitening Support Forum.
 

News:

Welcome to the SQLitening support forums!

Main Menu

Insertion error???

Started by Gary Stout, January 12, 2011, 01:02:00 PM

Previous topic - Next topic

Gary Stout

I am fighting a problem and so far have not been able to pinpoint the problem. When I try to insert a record, I get an error saying table has 79 fields and 756 items were supplied. All of the fields being insterted look normal. I did fix a few problems, but still haven;t found the cause of the problem.

Any ideas what I should be looking for?

Thanks,
Gary
Gary Stout
gary@sce4u.com

Fred Meier

Embedded single quotes or commas?  Can you post your insert code?

Gary Stout

#2
Fred,

Sorry for the delay. I didn't have what I needed on my main computer and had to wait til I was able to access my laptop.

Here is the Insertion code..... when I posted it, I had to clean up some line feeds and spaces that were not in the original source.



       slExe slBuildInsertOrUpdate("donateditems",Trim$(data_14.familyid)  & $NUL & _
                                                 Trim$(data_14.transid)    & $NUL & _                                                 
                                                 Trim$(data_14.last)       & $NUL & _
                                                 Trim$(data_14.first)      & $NUL & _                                                 
                                                 Trim$(data_14.date)       & $NUL & _
                                                 STR$(data_14.totalcontrib)& $NUL & _
                                                 Trim$(data_14.comments) & $NUL &  _                         
                                                 Trim$(data_14.item1)      & $NUL & _
                                                 Trim$(data_14.desc1)      & $NUL & _
                                                 Trim$(data_14.model1)     & $NUL & _
                                                 Trim$(data_14.serial1)    & $NUL & _
                                                 Trim$(data_14.qty1)       & $NUL & _
                                                 Trim$(data_14.value1)     & $NUL & _
                                                 Trim$(data_14.item2)      & $NUL & _
                                                 Trim$(data_14.desc2)      & $NUL & _
                                                 Trim$(data_14.model2)     & $NUL & _
                                                 Trim$(data_14.serial2)    & $NUL & _
                                                 Trim$(data_14.qty2)       & $NUL & _
                                                 Trim$(data_14.value2)     & $NUL & _
                                                 Trim$(data_14.item3)      & $NUL & _
                                                 Trim$(data_14.desc3)      & $NUL & _
                                                 Trim$(data_14.model3)     & $NUL & _
                                                 Trim$(data_14.serial3)    & $NUL & _
                                                 Trim$(data_14.qty3)       & $NUL & _
                                                 Trim$(data_14.value3)     & $NUL & _
                                                 Trim$(data_14.item4)      & $NUL & _
                                                 Trim$(data_14.desc4)      & $NUL & _
                                                 Trim$(data_14.model4)     & $NUL & _
                                                 Trim$(data_14.serial4)    & $NUL & _
                                                 Trim$(data_14.qty4)       & $NUL & _
                                                 Trim$(data_14.value4)     & $NUL & _
                                                 Trim$(data_14.item5)      & $NUL & _
                                                 Trim$(data_14.desc5)      & $NUL & _
                                                 Trim$(data_14.model5)     & $NUL & _
                                                 Trim$(data_14.serial5)    & $NUL & _
                                                 Trim$(data_14.qty5)       & $NUL & _
                                                 Trim$(data_14.value5)     & $NUL & _
                                                 Trim$(data_14.item6)      & $NUL & _
                                                 Trim$(data_14.desc6)      & $NUL & _
                                                 Trim$(data_14.model6)     & $NUL & _
                                                 Trim$(data_14.serial6)    & $NUL & _
                                                 Trim$(data_14.qty6)       & $NUL & _
                                                 Trim$(data_14.value6)     & $NUL & _
                                                 Trim$(data_14.item7)      & $NUL & _
                                                 Trim$(data_14.desc7)      & $NUL & _
                                                 Trim$(data_14.model7)     & $NUL & _
                                                 Trim$(data_14.serial7)    & $NUL & _
                                                 Trim$(data_14.qty7)       & $NUL & _
                                                 Trim$(data_14.value7)     & $NUL & _
                                                 Trim$(data_14.item8)      & $NUL & _                                                 
                                                 Trim$(data_14.desc8)      & $NUL & _
                                                 Trim$(data_14.model8)     & $NUL & _
                                                 Trim$(data_14.serial8)    & $NUL & _
                                                 Trim$(data_14.qty8)       & $NUL & _
                                                 Trim$(data_14.value8)     & $NUL & _
                                                 Trim$(data_14.item9)      & $NUL & _                                                 
                                                 Trim$(data_14.desc9)      & $NUL & _
                                                 Trim$(data_14.model9)     & $NUL & _
                                                 Trim$(data_14.serial9)    & $NUL & _
                                                 Trim$(data_14.qty9)       & $NUL & _
                                                 Trim$(data_14.value9)     & $NUL & _
                                                 Trim$(data_14.item10)     & $NUL & _
                                                 Trim$(data_14.desc10)     & $NUL & _
                                                 Trim$(data_14.model10)    & $NUL & _
                                                 Trim$(data_14.serial10)   & $NUL & _
                                                 Trim$(data_14.qty10)      & $NUL & _
                                                 Trim$(data_14.value10)    & $NUL & _
                                                 Trim$(data_14.item11)     & $NUL & _
                                                 Trim$(data_14.desc11)     & $NUL & _
                                                 Trim$(data_14.model11)    & $NUL & _
                                                 Trim$(data_14.serial11)   & $NUL & _
                                                 Trim$(data_14.qty11)      & $NUL & _
                                                 Trim$(data_14.value11)    & $NUL & _
                                                 Trim$(data_14.item12)      & $NUL & _
                                                 Trim$(data_14.desc12)     & $NUL & _
                                                 Trim$(data_14.model12)    & $NUL & _
                                                 Trim$(data_14.serial12)   & $NUL & _
                                                 Trim$(data_14.qty12)      & $NUL & _
                                                 Trim$(data_14.value12))


Gary Stout
gary@sce4u.com

Gary Stout

Hello All,

I finally tracked down my insertion error. In testing the fields being inserted, I discovered that the length of the fields that should have been empty was actually 2 bytes. It was obviously some un-printable character. Finally found out that it was a chr$(0). I removed all chr$(0)'s from each field and that solved that issue.

I do have another insertion question though..... when I insert a dollar amount (ie 35.00), instead of 35.00, I end up with 35.0 when viewing the data with SQL Expert. The field type in text and not numeric. Do I need to enclose the data in single quotes like dates to keep the last zero from being truncated?

Thanks again,
Gary
Gary Stout
gary@sce4u.com

Gary Stout

It looks like changing the field type from TEXT to REAL 7,2 may have solved this issue.

Gary
Gary Stout
gary@sce4u.com

Fred Meier

Glad you found your insertion error.  When you insert 35. or 35.0 or 35.000 SQLite will store it as a real number and will always return 35.0.  Changing the type to Real(7,2) will only change how SQLite Expert displays it.  It will still be 35.0 in the database.
SQLite Expert shows many different data types but their are only 5 in a SQLite database.

QuoteEach column in an SQLite 3 database is assigned one of the following type affinities:
TEXT
NUMERIC
INTEGER
REAL
NONE
see http://www.sqlitening.com/support/index.php?topic=3165.0


Gary Stout

Quote from: Fred Meier on January 15, 2011, 08:25:38 PM
When you insert 35. or 35.0 or 35.000 SQLite will store it as a real number and will always return 35.0.  Changing the type to Real(7,2) will only change how SQLite Expert displays it.  It will still be 35.0 in the database.

Fred,
I think it was the display that was the problem. I was inserting 35.00, but it was being displayed as 35.0. Changing from Text to Real seemed to cause it to display properly.

Thanks,
Gary
Gary Stout
gary@sce4u.com