I have a string Hi''Hello'''How r u'''
that I want to save in sqlite database through C#.
when I try doing that it throws the Exception
I have tried all the solutions currently present but still it is not working.
I have a string Hi''Hello'''How r u'''
that I want to save in sqlite database through C#.
when I try doing that it throws the Exception
I have tried all the solutions currently present but still it is not working.
Hi''Hello'''How r u'''
you will see there are multiple Single quote (') so please replace' by ''
.
Like as 'Hi''Hello''How r u'''
it will work.
for ex. create data table
sqlite> CREATE TABLE COMPANY(
ID INT PRIMARY KEY NOT NULL,
NAME TEXT NOT NULL,
AGE INT NOT NULL,
ADDRESS CHAR(50),
SALARY REAL
);
insert value >
INSERT INTO COMPANY (ID,NAME,AGE,ADDRESS,SALARY)
VALUES (1, 'Paul', 32,'California ', 20000.00 )
OR
INSERT INTO COMPANY (ID,NAME,AGE,ADDRESS,SALARY)
VALUES (1, 'Paul', 32, 'California "and" Japan ', 20000.00 )
OR
INSERT INTO COMPANY (ID,NAME,AGE,ADDRESS,SALARY)
VALUES (1, 'Paul', 32, 'California ''and'' Japan ', 20000.00 )
it will insert but if you will try to insert
INSERT INTO COMPANY (ID,NAME,AGE,ADDRESS,SALARY)
VALUES (1, 'Paul', 32, 'California 'and' Japan ', 20000.00 )
it will break SQl query syntax near 'and'
and show error . So remove '
quote or replace '
by ' '
.