title: simple login C# and MySQL web application
body: <p>I Have a few bugs in my code, for some reason when I try to catch at the end it throws up errors saying it is missing lots of brackets although I don't think it is.
  could some one please let me know where I have gone wrong.</p>
  
  <p><strong>Code:</strong></p>
  
  <pre><code>namespace login
  {
     public partial class _Default : Page
     {
        // decleration of tabels and dataadapters including my connection string for my MySQL databse
        DataSet ds = new DataSet();
        MySqlConnection cs = new MySqlConnection(@"SERVER= ********;username=******;password=******;Allow Zero Datetime=true; Initial Catalog = benoatsc_GreenFilm");
  
        MySqlDataAdapter da = new MySqlDataAdapter();
        DataTable dt = new DataTable();
        String totalDonations = string.Empty;
  
        protected void Button1_Click(object sender, EventArgs e)
        {
           try
           {
              MySqlCommand SelectCommand = new MySqlCommand("select * from films.user where user_name='" + this.username.Text + "; and password='" + this.password.Text + "';", cs);
              MySqlDataReader myreader;
              cs.Open();
              myreader = SelectCommand.ExecuteReader();
  
              int count = 0;
              while (myreader.Read())
              {
                 count = count + 1;
              }
  
              if (count == 1)
              {
                 Response.Write(@"&lt;script language='javascript'&gt;alert('wow your in !!');&lt;/script&gt;");
              }
  
              else if (count &gt; 1)
              {
                 Response.Write(@"&lt;script language='javascript'&gt;alert('duplicate');&lt;/script&gt;");
              }
  
              else Response.Write(@"&lt;script language='javascript'&gt;alert('wrong password');&lt;/script&gt;");
  
              cs.Close();
           }
  
           catch (Exception ex)
           {
              Response.Write(@"&lt;script language='javascript'&gt;alert(ex.message);&lt;/script&gt;");
           }
        }
     }
  }
  </code></pre>