Quantcast
Channel: Recent Threads — Xamarin Community Forums
Viewing all articles
Browse latest Browse all 204402

SQL Connection working on DEBUG mode not on RELEASE

$
0
0

Hey guys,

I have a problem with connecting to database.

Everything works well on debug mode, but when I'm changing to RELEASE mode "Application Unfortunately has Stopped".
There is a problem with "con.Open();

What is going on here.

MySqlConnection con = new MySqlConnection("Server=bartuszak.pl;Port=3306;database=android;User Id=android;Password=##;charset=utf8");

            try
            {
                if (con.State == ConnectionState.Closed)
                {
                    con.Open();


                    MySqlCommand cmd = new MySqlCommand();
                    cmd.CommandText = string.Format("SELECT ID,User_FirstName FROM Users WHERE User_Email ='" + txtEmailZaloguj.Text + "' AND User_Password='" + txtPasswordZaloguj.Text + "'");
                    cmd.Connection = con;
                    MySqlDataReader reader = cmd.ExecuteReader();
                    if (reader.Read())
                    {
                        ZalogujSuccess = true;
                        int ID = int.Parse(reader.GetString(0));
                        string User_FirstName = reader.GetString(1);

                        txtSysLog.Text = string.Format("Zalogowny jako: {0}\nID: {1}\nZamknij dialog i kliknij zaloguj!", User_FirstName, ID);
                    }
                    else
                    {
                        txtSysLog.Text = "Błędne hasło lub email!";
                    }

                    reader.Close();
                }
            }
            catch (MySqlException ex)
           {
              txtSysLog.Text = ex.ToString();
           }
            finally
            {
                con.Close();
            }

Viewing all articles
Browse latest Browse all 204402

Latest Images

Trending Articles



Latest Images

<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>