I keep receiving this error and I'm unsure how to fix it.
The code I have is
protected void AddUserToDatabase(String username, String Password, String Email)
{
OleDbConnection conn;
OleDbCommand cmd;
using (conn = new OleDbConnection(ConfigurationManager.ConnectionStrings["ProjectDatabaseConnectionString"].ConnectionString))
{
using (cmd = conn.CreateCommand())
{
cmd.CommandText = "INSERT INTO Users(username, password, emailAddress) VALUES(@username, @password, @email)";
cmd.CommandType = CommandType.Text;
cmd.Parameters.AddWithValue("@username", username);
cmd.Parameters.AddWithValue("@password", Password);
cmd.Parameters.AddWithValue("@email", Email);
conn.Open();
cmd.ExecuteNonQuery();
}
}
}
It is saying the error is on the line with cmd.CommandType = CommandType.Text;
Any help would be great, thanks