Note that there are some explanatory texts on larger screens.

plurals
  1. POSqlite3 gives "Error : Constraint failed" - interfacing to AM1808
    primarykey
    data
    text
    <p>Hello I am using sqlite3 for database management for my AM1808. I have created a new table named MilkRateChartEditDetail.</p> <pre><code>const char *SQL_CREATE_MILKRATECHARTDETAILEDITTABLE = "CREATE TABLE IF NOT EXISTS MilkRateChartEditDetail ( \ MilkRateChartEditDetailId INTEGER, \ MilkRateChartId INTEGER \ REFERENCES MilkRateChart(MilkRateChartId) \ ON UPDATE RESTRICT ON DELETE RESTRICT, \ EffectiveDate DATE, \ EffectiveShift UNSIGNED TINYINT, \ MilkType UNSIGNED TINYINT, \ RCD_RateChartId UNSIGNED INT,\ SocietyCode STRING, \ RateType STRING, \ FAT FLOAT, \ LRCLR FLOAT, \ SNF FLOAT, \ Solid FLOAT, \ Rate FLOAT, \ NewRate FLOAT, \ UpdatedBy INTEGER \ REFERENCES UserMaster(UsermasterId) \ ON UPDATE RESTRICT ON DELETE RESTRICT, \ UpdatedOn DATE, \ FlagGSM UNSIGNED TINYINT, \ FlagUSB UNSIGNED TINYINT, \ PRIMARY KEY (MilkRateChartEditDetailId))"; </code></pre> <p>Now i am trying to insert data into the table using following query.</p> <pre><code>const char *INSERT_MILKRATECHARTEDITDETAILTABLE = "INSERT INTO MilkRateChartEditDetail \ (MilkRateChartEditDetailId,MilkRateChartId, \ EffectiveDate,EffectiveShift,MilkType, \ RCD_RateChartId,SocietyCode,RateType, \ FAT,LRCLR,SNF,Solid,Rate,NewRate, \ UpdatedBy,UpdatedOn,FlagGSM,FlagUSB) \ VALUES(NULL,?,?,?,?,?,?,?,?,?,?,?,?,?,NULL,?,?,?)"; </code></pre> <p>My data is : </p> <pre><code>RateChartId : 1 EffectiveDate : 10-12-2012 Shift : E RateType : FAT MilkRateChartId : 30 FAT : 11.100000 SNF : 0.000000 Solid : 0.000000 CLR : 0.000000 Updatedby : 1 MilkType : C Rate : 0.000000 NewRate : 0.000000 </code></pre> <p>I am getting an Error:</p> <blockquote> <p>INSERT MILKRATECHARTEDITDETAILTABLE, ENTRY :'constraint failed'</p> </blockquote> <p>I can not understand what is the problem ? how can i get out of this ?</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload