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