Hello everyone I need help with adding a column in ms access database and update it with a value.Here is my code, it gives an error that says syntax error in field definition.plea se correct me.
Code:
string myConn = " ";
myConn = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=C:/Users/EmployeeAttendanceRegister/EmployeeAttendanceRegister.accdb";
OleDbConnection myCon = new OleDbConnection(myConn);
string myInsert = "ALTER TABLE Attendance ADD COLUMN SignIn" + dateTimePicker1.Value;
OleDbCommand myCom = new OleDbCommand(myInsert);
myCom.Connection = myCon;
myCon.Open();
try
{
myCom.ExecuteNonQuery();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message.ToString());
}
myCon.Close();
}
Comment