i write code that insert some data into Microsoft Access database but i have an error "Syntax error in insert into statement" i don't know why !!!Please help me. thanks Advance
我写的代码将一些数据插入Microsoft Access数据库,但我有一个错误“插入到语句中的语法错误”我不知道为什么!!!请帮助我。谢谢进展
Its showing below error
它显示以下错误
2 个解决方案
#1
3
Due to the space in the column name, I think you need to delimit the "Book Name" identifier with square brackets, i.e.:
由于列名中的空格,我认为您需要用方括号分隔“书名”标识符,即:
insert into book ([Book Name],Description)
#2
0
Try this.Remove ; and put BookName instead of book name
试试这个。并将BookName而不是书名
oleDbCmd.CommandText = "insert into book (BookName,Description) values ('" +textBookName.Text+ "','" +textDescription.Text+ "')";
#1
3
Due to the space in the column name, I think you need to delimit the "Book Name" identifier with square brackets, i.e.:
由于列名中的空格,我认为您需要用方括号分隔“书名”标识符,即:
insert into book ([Book Name],Description)
#2
0
Try this.Remove ; and put BookName instead of book name
试试这个。并将BookName而不是书名
oleDbCmd.CommandText = "insert into book (BookName,Description) values ('" +textBookName.Text+ "','" +textDescription.Text+ "')";