title: c# login registration form registers user details only 1 time
body: <p>I've created a c# user registration form with md5 encryption... But my problem is I want to register a user detail under the "Admin level" at only one time..</p>
  
  <p>What i want is when i seleet the admin level and try to re register as another user,the system might not give permission to register another admin..and shows a message box as "Sorry the admin has already registered in the system"...</p>
  
  <p>my code is........</p>
  
  <pre><code>if (textBox1.Text != "" &amp;&amp; textBox2.Text != "" &amp;&amp; comboBox1.Text != "" &amp;&amp; (comboBox1.Text == "Administrator" || comboBox1.Text == "Employee" || comboBox1.Text == "Developer"))
          {
  
              connection.Open();
              string TypeUser;
              int level = Convert.ToInt32(0);
  
              TypeUser = comboBox1.Text;
  
              if (TypeUser == "Administrator")
              {
                  level = 1;
  
              }
              else if (TypeUser == "Employee")
              {
                  level = 2;
  
              }
              else if (TypeUser == "Developer")
              {
                  level = 3;
  
              }
  
  
              MySqlDataReader dr;
              MySqlCommand cmd;
              string sql = "INSERT INTO users(name,password,level) VALUES('" + textBox1.Text + "',MD5('" + textBox2.Text + "'),'" + level + "')";
              cmd = new MySqlCommand();
              cmd.CommandType = CommandType.Text;
              cmd.CommandText = sql;
              cmd.Connection = connection;
              dr = cmd.ExecuteReader();
  
              MessageBox.Show("Registration Success !","Success",MessageBoxButtons.OK,MessageBoxIcon.Information);
              connection.Close();
              cmd.Dispose();
          }
  
          else
          {
              MessageBox.Show("All Fields must be required / something is wrong", "error", MessageBoxButtons.RetryCancel, MessageBoxIcon.Error);
          }
  </code></pre>