You've got detailed answers here: I am trying to insert a date of birth into a database
Date is a date, NOT its string representation!!!
Your code is is invalid, because:
parameter is null, due to usage of
variable, instead od
2) parameter name should be peceded by "
if (txtboxdob.Text != "")
DateTime dob = DateTime.ParseExact(txtboxdob.Text, "dd-MM-yyyy", null);
cmd.Parameters.Add(DataAccess.CreateParameter(cmd, "@DateofBirth", DbType.DateTime, dob));
In MS Access database engine, a name of parameter is not important, because an OleDb provider is not able to recognize the names. Important is to pass parameters in order in which they were used in a query!
So, if there is more than one parameter, check it out if they are passed in a correct order.