0
  public string Data()  
        {
            string dohvat_podatka = "";


            using ( MySqlConnection con = new MySqlConnection("Server=xxx.000webhost.com;Port=3306;Database=xxx;Uid=xxx;password=xxx;"))
            {
                con.Open();
                using (MySqlCommand cmd = new MySqlCommand("SELECT ime FROM `nastavnik` WHERE prezime=@prezime", con))
                {
                    cmd.Parameters.Add(new MySqlParameter("prezime", "Carić"));

                    using (MySqlDataReader dr = cmd.ExecuteReader())
                    {
                        if (dr.HasRows)
                        {
                            while (dr.Read())
                            {
                                dohvat_podatka = dr.GetString(0);
                            }
                        }

                    }


                }

            }

            return dohvat_podatka;
        }

So what I m trying to do is to connect from my asp.net FREE HOST to a MySql FREE HOST. Is this connection possible? Of course I m getting a error due to the specified connection. I think that the problem is the free hosting that does not allow such a connection to their servers, what' s your opinion?
By the way I m having huge problems with mssql so i can't host on somee.com which would be the best way, but It would me take me like a week to do that.

Edited by pritaeas: Removed credentials from connection string.

2
Contributors
4
Replies
11
Views
3 Years
Discussion Span
Last Post by castajiz_2
0

I think that the problem is the free hosting that does not allow such a connection to their servers, what' s your opinion?

Usually not with free hosting. You should check your cPanel (or WHM) if it's possible to allow an IP address for external connection (Remote MySQL Access).

0

Ok I hope that this is the problem(I ll pay them then but first I ll check it).My second question is, will somee.com free asp.net package allow me to make this external connection since it's a free package that I m using?

0

My friend suggested me something else, he s got a good package at some popular hosting company.... I ll try to sort things out tomorrow and I ll give some feedback.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.