Just to add to what Mehdi says:
Do not concatenate strings to build a SQL command. It leaves you wide open to accidental or deliberate SQL Injection attack which can destroy your entire database. Use Parametrized queries instead. The chances are that will cure the problem you have spotted.
There are two other problems here:
1) You should Dispose OleDb objects when you are finished with them:
using (OleDbConnection con = GetConnection())
{
using (OleDbCommand cmd = new OleDbCommand("INSERT INTO usermaster (FullName,UserName,Password,Address,EmailID,ContactNo) VALUES (@NM, @UN, @PW, @AD, @EM, @CN)", con))
{
cmd.Parameters.AddWithValue("@NM", firstnm + " " + lastnm);
cmd.Parameters.AddWithValue("@UN", unm);
cmd.Parameters.AddWithValue("@PW", pwd);
cmd.Parameters.AddWithValue("@AD", add);
cmd.Parameters.AddWithValue("@EM", email);
cmd.Parameters.AddWithValue("@CN", contact);
con.Open();
return (cmd.ExecuteNonQuery());
}
}
2) Never store passwords in clear text - it is a major security risk. There is some information on how to do it here:
Password Storage: How to do it.[
^]