3

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

6
  • You're missing a terminating semicolon, but that might not matter. More important is for you to show us your table structure. Commented Apr 27, 2018 at 7:43
  • What's the version of sqlite DLL you're using? This multi-values syntax was introduced in 3.7.11 sqlite.org/changes.html#version_3_7_11 Commented Apr 27, 2018 at 7:46
  • sqlite3 version is : 3.15.2 & i added the table structure to the post. Thanks Commented Apr 27, 2018 at 7:51
  • If you're having issues with sqlite.dll, then its version is what's interesting. select sqlite_version(); to find out. Commented Apr 27, 2018 at 7:52
  • Try removing single quotes around numbers. Because with it it is treated as string and in your table SeqNo is an integer column Commented Apr 27, 2018 at 8:05

1 Answer 1

1

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;
Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.