HARI
HARI

Reputation: 67

Syntax error in insert into statement in C#. While inserting the values to access

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

enter image description here Its showing below errorenter image description here

Upvotes: 0

Views: 295

Answers (2)

Nagaraj S
Nagaraj S

Reputation: 13474

Try this.Remove ; and put BookName instead of book name

oleDbCmd.CommandText = "insert into book (BookName,Description) values ('" +textBookName.Text+ "','" +textDescription.Text+ "')";

Upvotes: 0

Ian Nelson
Ian Nelson

Reputation: 58703

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)

Upvotes: 3

Related Questions