SqlConnection Error on the TC20 Android

R Randy Gordey 3 years 7 months ago
7 0 0

My code works on Both Emulators: oreo and marshmallow.

button.Click += (o, e) =>
            {
                try
                {
                    SqlConnection sqlConnection = new SqlConnection(connectionString);
                    string select = "Select * From [dbo].[bma_users] Where username = '" + name.Text + "'";
                    SqlCommand sqlCommand = new SqlCommand(select, sqlConnection);
                    sqlConnection.Open();
                    SqlDataReader dr = sqlCommand.ExecuteReader();

                    if (dr.HasRows == true)
                    {
                        StartActivity(typeof(LandingPage));
                    }
                    else
                    {
                        result.Text = "Failure";
                    }

                    sqlConnection.Close();
                }
                catch(SqlException ex)
                {
                    foreach(var error in ex.Errors)
                    {
                        Console.WriteLine("Found an exception {0}:", error);
                    }
                   
                }

As I said this works on emulators but not on the TC20.

07-20 13:13:36.587 I/mono-stdout(24804): Found an exception System.Data.SqlClient.SqlError: Snix_Connect (provider: SNI_PN7, error: 40 - SNI_ERROR_40):
Found an exception System.Data.SqlClient.SqlError: Snix_Connect (provider: SNI_PN7, error: 40 - SNI_ERROR_40):
07-20 13:13:36.593 I/Choreographer(24804): Skipped 1006 frames!  The application may be doing too much work on its main thread.

Any help would be greatly appreciated. Thanks in advance.

CONTACT
Can’t find what you’re looking for?