Couple of things:
How do you know it did not work? Do you get the "Registration Failed!" message box? Or does it not appear in your database?
Several changes are needed here:
1) Don't do it this way. You are wide open to an SQL Injection attack, even by mistake. Instead, use SqlCeCommand.AddWithValue:
using (SqlCeConnection con = new SqlCeConnection(DBConn.connString))
{
con.Open();
string SQL = "INSERT INTO USERINFO (UserID,Password,Name,Cell,Email,Status)" +
" VALUES (@ID, @PW, @NM, @CN, @EM, 0)";
SqlCeCommand com = new SqlCeCommand(SQL, con);
com.AddWithValue("@ID", txtUserID.Text);
com.AddWithValue("@PW", txtPassword.Text);
com.AddWithValue("@NM", txtName.Text);
com.AddWithValue("@CN", txtCellNo.Text);
com.AddWithValue("@EM", txtEmail.Text);
com.ExecuteNonQuery();
MessageBox.Show("User Registration Successfull!");
}
2) Change your exception so that it catches and reports the problem:
catch (Exception ex)
{
MessageBox.Show("Registration Failed!\n" + ex.ToString());
}
That way at least it tells you you have a problem and give you information on what the problem is! (It is considered bad practice to use empty catch blocks)
The second change may give you enough info to solve the problem: It may be that the UserID already exists, or a similar problem.