title: The name '"' does not exist in the current context
body: <p>I am facing several errors in my code. These errors are:</p>
  
  <ul>
  <li>Error 17  The name 'CommandType' does not exist in the current context    </li>
  <li>Error 18  The name 'SqlDbType' does not exist in the current context  </li>
  <li>Error 35  The name 'txtCity' does not exist in the current context    </li>
  </ul>
  
  <p>I would like if you can help me to understand the error and tell me how I can fix it. </p>
  
  <pre><code>protected void btnSave_Click(object sender, EventArgs e)
  {
      // create connectionstring and insert statment
      string connectionString = ConfigurationManager.ConnectionStrings["connectionString"].ConnectionString;
      string insertSql = " INSERT INTO UserInfo (UID, FN, LN, Password, RePass, Email, Country,State, City)" +
          " values (@UsrNme, @fnbox, @lnamebox, @passtxtbx1, @passtxtbx2, @emailbox, @DrDncoundrlst, @DropDownListSwestate, @citytxtbox)";
  
      // create SQL Connection
  
      SqlConnection con = new SqlConnection(connectionString);
  
      // create sql command and parameters
  
      SqlCommand cmd = new SqlCommand();
      cmd.Connection = con;
      cmd.CommandType = CommandType.text;
      cmd.CommandText = insertSql;
  
      SqlParameter UID = new SqlParameter("@UsrNme", SqlDbType.nvarchar, 50);
      UID.Value = txtUID.text.tostring();
      cmd.Parameters.Add(UID);
  
      SqlParameter FN = new SqlParameter("@fnbox", SqlDbType.varchar,25);
      cmd.Connection = con;
      FN.Value = txtfn.text.ToString();
      cmd.Parameters.Add(FN);
  
  
  
      SqlParameter LN = new SqlParameter("@lnamebox", SqlDbType.varchar, 25);
      cmd.Connection = con;
      LN.Value = txtLN.text.ToString();
      cmd.Parameters.Add(LN);
  
      SqlParameter Password = new SqlParameter("@passtxtbx1", SqlDbType.varchar, 25);
      cmd.Connection = con;
      Password.Value = txtPassword.text.ToString();
      cmd.Parameters.Add(Password);
  
  
      SqlParameter RePass = new SqlParameter("@passtxtbx2", SqlDbType.varchar, 25);
      cmd.Connection = con;
      RePass.Value = txtRePass.text.ToString();
      cmd.Parameters.Add(RePass);
  
  
      SqlParameter Email = new SqlParameter("@emailbox", SqlDbType.varchar, 25);
      cmd.Connection = con;
      Email.Value = txtEmail.text.ToString();
      cmd.Parameters.Add(Email);
  
      SqlParameter Country = new SqlParameter("@DrDncoundrlst", SqlDbType.varchar, 25);
      cmd.Connection = con;
      Country.Value = txtCountry.text.ToString();
      cmd.Parameters.Add(Country);
  
      SqlParameter State = new SqlParameter("@DropDownListSwestate", SqlDbType.varchar, 25);
      cmd.Connection = con;
      State.Value = txtState.text.ToString();
      cmd.Parameters.Add(State);
  
      SqlParameter City = new SqlParameter("@citytxtbox", SqlDbType.varchar, 25);
      cmd.Connection = con;
      City.Value = txtCity.text.ToString();
      cmd.Parameters.Add(City);
  
      try
      {
          con.Open();
          cmd.ExecuteNonQuery();
          lblmsg.Text = "You already complete your registration process";
      }
      catch (SqlException ex)
      {
          string errorMessage = "error in registration user";
          errorMessage += ex.Message;
          throw new Exception(errorMessage);
      }
  
      finally
      {
          con.Close();
      }
  
  }
  </code></pre>