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.

Recommended Answers

All 4 Replies

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).

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?

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.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.