2

I am using sqlite3 and trying to put data into my database.

INSERT INTO Structure VALUES
('521D5E7ABC165','1','DECODE','T','4','Y','Y'),
('521D5E7ABC165','2','DEDESC','T','40','N','Y'), 
('521D5E7ABC165','3','DDZMD8','T','10','N','Y'), 
('521D5E7ABC165','4','DDZMTM','T','8','N','Y'), 
('521D5E7ABC165','5','DDZMID','T','10','N','Y'), 
('521D5E7ABC165','6','DDZMTL','T','10','N','Y'), 
('521D5E7ABC165','7','DDZMBR','T','5','N','Y'),
('521D5E7ABC165','8','DDZND8','T','10','N','Y'), 
('521D5E7ABC165','9','DDZNTM','T','8','N','Y'), 
('521D5E7ABC165','10','DDZNID','T','10','N','Y'), 
('521D5E7ABC165','11','DDZNTL','T','10','N','Y'), 
('521D5E7ABC165','12','DDZNBR','T','5','N','Y')

I try executing the command in DBBrowser for SQLLITE it works but when i try to execute through System.Data.SQLite.dll - ExecuteNonQuery it return me error :

"SQLite error near ",": syntax error"

Can anyone help ?

Here is the table structure

CREATE TABLE `Structure` (
    `HeaderID`  TEXT,
    `SeqNo` INTEGER,
    `FieldName` TEXT,
    `FieldType` TEXT,
    `FieldLength`   TEXT,
    `IsKey` TEXT,
    `IncludeRecord` TEXT,
    PRIMARY KEY(`HeaderID`,`SeqNo`)
);

and the sqlite3 version is : 3.15.2

koaybl
  • 21
  • 1
  • 4
  • You're missing a terminating semicolon, but that might not matter. More important is for you to show us your table structure. – Tim Biegeleisen Apr 27 '18 at 07:43
  • What's the version of sqlite DLL you're using? This multi-values syntax was introduced in 3.7.11 https://www.sqlite.org/changes.html#version_3_7_11 – laalto Apr 27 '18 at 07:46
  • sqlite3 version is : 3.15.2 & i added the table structure to the post. Thanks – koaybl Apr 27 '18 at 07:51
  • If you're having issues with sqlite.dll, then its version is what's interesting. `select sqlite_version();` to find out. – laalto Apr 27 '18 at 07:52
  • Try removing single quotes around numbers. Because with it it is treated as string and in your table `SeqNo` is an integer column – Krzysztof Janiszewski Apr 27 '18 at 08:05
  • `@KrzysztofJaniszewski` i removed the single quote for `SeqNo` and the result is still the same. – koaybl Apr 27 '18 at 08:11

1 Answers1

0

Works for me with the SQL directly copied from your question (plus a terminating ;).

% sqlite3 so.sqlite3 
SQLite version 3.11.0 2016-02-15 17:29:24
Enter ".help" for usage hints.
sqlite> CREATE TABLE `Structure` (
   ...>     `HeaderID`  TEXT,
   ...>     `SeqNo` INTEGER,
   ...>     `FieldName` TEXT,
   ...>     `FieldType` TEXT,
   ...>     `FieldLength`   TEXT,
   ...>     `IsKey` TEXT,
   ...>     `IncludeRecord` TEXT,
   ...>     PRIMARY KEY(`HeaderID`,`SeqNo`)
   ...> );
sqlite> INSERT INTO Structure VALUES
   ...> ('521D5E7ABC165','1','DECODE','T','4','Y','Y'),
   ...> ('521D5E7ABC165','2','DEDESC','T','40','N','Y'), 
   ...> ('521D5E7ABC165','3','DDZMD8','T','10','N','Y'), 
   ...> ('521D5E7ABC165','4','DDZMTM','T','8','N','Y'), 
   ...> ('521D5E7ABC165','5','DDZMID','T','10','N','Y'), 
   ...> ('521D5E7ABC165','6','DDZMTL','T','10','N','Y'), 
   ...> ('521D5E7ABC165','7','DDZMBR','T','5','N','Y'),
   ...> ('521D5E7ABC165','8','DDZND8','T','10','N','Y'), 
   ...> ('521D5E7ABC165','9','DDZNTM','T','8','N','Y'), 
   ...> ('521D5E7ABC165','10','DDZNID','T','10','N','Y'), 
   ...> ('521D5E7ABC165','11','DDZNTL','T','10','N','Y'), 
   ...> ('521D5E7ABC165','12','DDZNBR','T','5','N','Y');
sqlite> .dump
PRAGMA foreign_keys=OFF;
BEGIN TRANSACTION;
CREATE TABLE `Structure` (
    `HeaderID`  TEXT,
    `SeqNo` INTEGER,
    `FieldName` TEXT,
    `FieldType` TEXT,
    `FieldLength`   TEXT,
    `IsKey` TEXT,
    `IncludeRecord` TEXT,
    PRIMARY KEY(`HeaderID`,`SeqNo`)
);
INSERT INTO "Structure" VALUES('521D5E7ABC165',1,'DECODE','T','4','Y','Y');
INSERT INTO "Structure" VALUES('521D5E7ABC165',2,'DEDESC','T','40','N','Y');
INSERT INTO "Structure" VALUES('521D5E7ABC165',3,'DDZMD8','T','10','N','Y');
INSERT INTO "Structure" VALUES('521D5E7ABC165',4,'DDZMTM','T','8','N','Y');
INSERT INTO "Structure" VALUES('521D5E7ABC165',5,'DDZMID','T','10','N','Y');
INSERT INTO "Structure" VALUES('521D5E7ABC165',6,'DDZMTL','T','10','N','Y');
INSERT INTO "Structure" VALUES('521D5E7ABC165',7,'DDZMBR','T','5','N','Y');
INSERT INTO "Structure" VALUES('521D5E7ABC165',8,'DDZND8','T','10','N','Y');
INSERT INTO "Structure" VALUES('521D5E7ABC165',9,'DDZNTM','T','8','N','Y');
INSERT INTO "Structure" VALUES('521D5E7ABC165',10,'DDZNID','T','10','N','Y');
INSERT INTO "Structure" VALUES('521D5E7ABC165',11,'DDZNTL','T','10','N','Y');
INSERT INTO "Structure" VALUES('521D5E7ABC165',12,'DDZNBR','T','5','N','Y');
COMMIT;