Hi,
I have xamarin forms app and I want to connect my app to my shared server mysql database. I want to connect my app with mysql database that is on real server here is the code to do this.
- MySqlConnectionStringBuilder sb = new MySqlConnectionStringBuilder();
- sb.Server = "my ip addres or domain name";
- sb.Port = 3306;
- sb.UserID = "myuserid";
- sb.Password = "mypassword";
- sb.Database = "mydbname";
- sb.CharacterSet = "utf8";
- try
- {
- MySqlConnection con = new MySqlConnection(sb.ToString());
- if (con.State == ConnectionState.Closed)
- {
- con.Open();
- DisplayAlert("alert", "successfully connected", "ok");
- }
- }
- catch (Exception ex)
- {
- DisplayAlert("Error", ex.Message, "ok");
- }
I used Xamarin.MySql.Data Plugin in my xamarin form app.
https://www.nuget.org/packages/Xamarin.MySql.Data/
Please help me I want to online my xamarin form app/connect to my domain cpenal hosting.