Quantcast
Channel: Xamarin.Forms — Xamarin Community Forums
Viewing all articles
Browse latest Browse all 77050

App Crashes when connecting to remote database

$
0
0

Hi Forum why is that my app crashes when connecting to the database server that it is in the US
here is my code for connecting to database

        SqlConnectionStringBuilder dbConnect = new SqlConnectionStringBuilder();
        dbConnect.DataSource = "my.rem.servr.host";
        dbConnect.UserID = "test123456";
        dbConnect.Password = "XXXXX";

        using (var ConnectedtoDatabase = new SqlConnection(dbConnect.ConnectionString))
        {
            try
            {
                ConnectedtoDatabase.Open();
                Label label = new Label
                {
                    Text = "Success connecting"
                };
                Content = label;


            }
            catch (SqlException)
            {
                Label label = new Label
                {
                    Text = "Fail on Connecting"
                };
                Content = label;
            }
        }

Viewing all articles
Browse latest Browse all 77050

Trending Articles



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