TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Katie B
NA
66
18k
INSERT INTO Syntax Error
Apr 10 2013 3:24 PM
Hi All,
Ive been trying to write code that will allow the data to be taken from a user entering data into the text boxes, then having this inserted into my access database. But each time I do I get an error saying that there is a syntax error in the Insert Into statement. I've put in bold the line the runtime error appears on. Any help would be much appreciated:
{
string connectionString =
"provider=Microsoft.ACE.Oledb.12.0;" +
"data source=C:\\Users\\Documents\\StudentRegistrationDatabase.accdb";
OleDbConnection myOleDbConnection = new OleDbConnection(connectionString);
OleDbCommand myOleDbCommand = myOleDbConnection.CreateCommand();
myOleDbConnection.Open();
myOleDbCommand.CommandText = "INSERT INTO StudentDetails ([Forename],[Surname],[CourseName],[DOB],)" +
"VALUES('" + txtFirstName.Text + "','" + txtLastName.Text + "','" + txtCourseName.Text + "',' + txtDOB.Text + ')";
myOleDbCommand.ExecuteNonQuery();
Thanks in advance Kate
Reply
Answers (
2
)
Sharing data between threads of different methods
Automated testing to check a webpage on a site is displayed?