I want to launch a query that will write a 3 fields on a C# winforms back to an ms-access database
Pressing the button Add Time Sheet executes the query and returns an error Syntax error comma in query expression
Add Time Sheet
Syntax error comma in query expression
You can see the error in the linked screenshot and a part of it above.
When I try put one field in the query my query writes back to access database successfully. it only gives me the comma error when i try to insert multiple fields
connection.Close(); connection.Open(); OleDbCommand command = new OleDbCommand(); command.Connection = connection; command.CommandText = "INSERT INTO ResourceWorkHours (WorkWeek, HoursWorked,FirstName) SELECT ('" + ddlWeeks2.Text + "','" + txtWorkHours.Text + "','" + cbResourceFirstName.Text + "') FROM Resources INNER JOIN ResourceWorkHours ON Resources.ResourceID = ResourceWorkHours.ResourceID"; command.ExecuteNonQuery(); MessageBox.Show("Employee Added to Database"); connection.Close(); }catch (Exception ex){ MessageBox.Show("ERROR" + ex); } connection.Close();