我已经将 SQLite3 与我的 Am1808 处理器连接起来。我将数据存储在 SD 卡中。
它工作得很好。我插入了一个包含 38 个字段的表格。现在我想在同一个表中添加一列。所以我更改了表字段参数,并在相关文件中进行了相应的更改。我的代码成功编译,但是当我执行应用程序时,它给了我以下错误:
错误:“39 个值的 38 列”
这是我通过修改创建的表:
const char *SQL_CREATE_ABCTABLE = "CREATE TABLE IF NOT EXISTS MilkCollection \
( MilkCollectionId INTEGER, \
CollectionDate DATE, \
CollectionShift UNSIGNED TINYINT, \
MemberId INTEGER REFERENCES Member(MemberId) ON UPDATE RESTRICT ON DELETE RESTRICT, \
SocietyId INTEGER REFERENCES Society(SocietyId) ON UPDATE RESTRICT ON DELETE RESTRICT, \
SampleNo UNSIGNED INTEGER, \
MilkType UNSIGNED TINYINT, \
Qty FLOAT, \
ActualQty FLOAT, \
QtyType UNSIGNED TINYINT, \
Fat FLOAT, \
ActualFat FLOAT, \
LRCLR FLOAT, \
ActualLRCLR FLOAT, \
SNF FLOAT, \
ActualSNF FLOAT, \
Solid FLOAT, \
ActualSolid FLOAT, \
Water FLOAT, \ // I have inserted this field
FatKG FLOAT, \
ActualFatKG FLOAT, \
SNFKG FLOAT, \
ActualSNFKG FLOAT, \
Rate FLOAT, \
Amount FLOAT, \
ActualAmount FLOAT, \
CanNumber UNSIGNED INTEGER, \
MemberCodeAuto UNSIGNED TINYINT, \
WeightAuto UNSIGNED TINYINT, \
FatAuto UNSIGNED TINYINT, \
LRCLRAuto UNSIGNED TINYINT, \
SNFAuto UNSIGNED TINYINT, \
EntryMode UNSIGNED TINYINT, \
CreatedBy INTEGER REFERENCES UserMaster(UsermasterId) ON UPDATE RESTRICT ON DELETE RESTRICT, \
CreatedOn DATE, \
UpdatedBy INTEGER REFERENCES UserMaster(UsermasterId) ON UPDATE RESTRICT ON DELETE RESTRICT, \
UpdatedOn DATE, \
FlagGSM UNSIGNED TINYINT, \
FlagUSB UNSIGNED TINYINT, \
PRIMARY KEY (MilkCollectionId) )";
创建此表后,我删除了旧的数据库文件。
我仍然收到此错误。