Home > database >  Consult: write data to the sqlite database is not successful?
Consult: write data to the sqlite database is not successful?

Time:10-06

Using the following statement to write a content database,
String a="fire alarm controller";
String SQL="insert into the message type (controller) values (a)";
SQLiteCommand command=new SQLiteCommand (SQL, myConnection);
The command. ExecuteNonQuery ();

Database table definition of the char types,

1. When a not single quotes, complains
As follows: the SQL logic error or missing database

No to the column: a

2. When a plus single quotes, 'a', is not an error, but the database is written in the letters a, not the content of the string variable fire alarm controller,

I want to write the words is fire alarm controller, senior counsel,

CodePudding user response:

The field name is controller type? Careful with Chinese characters field name
In you spell string SQL="insert into the message type (controller) values (a)";
You should put a hold, to write the real content, and to have single wrapped up

CodePudding user response:

The type is the column in the database, the controller name,

Cannot be directly into a string variable?
  • Related