Mysql connection

Newbie Spellweaver
Joined
Feb 18, 2007
Messages
21
Reaction score
0
Hello,

I recently added the DB to my webhost, cause I didn't want to have the DB on my computer.

Now the problem is, how to connect the server to the certain IP?

Code:
                Console.Title = "servername";
                Ini Config = new Ini(System.Windows.Forms.Application.StartupPath + @"\Config.ini");
                ServerIP = Config.ReadValue("Server", "ServerIP");
                ExternalDatabase.DBUserName = Config.ReadValue("Server", "DBUserName");
                ExternalDatabase.DBUserPass = Config.ReadValue("Server", "DBUserPass");

This doesn't say the ip connection.

Could anyone help me please?


Greetz
 
in the external db u can find
Code:
    public static bool Connect(string user, string pass)
    {
        try
        {
            Connection = new MySqlConnection("Server='localhost';Database='coproj';Username=" + MakeSafeString(user) + ";Password=" + MakeSafeString(pass));
            Connection.Open();
            return true;
        }
        catch
        {
            return false;
        }
    }
u have to modify "localhost" to ur DB hoster ip or site something like
Code:
    public static bool Connect(string user, string pass)
    {
        try
        {
            Connection = new MySqlConnection("Server='UrDBHostIP/Site!';Database='coproj';Username=" + MakeSafeString(user) + ";Password=" + MakeSafeString(pass));
            Connection.Open();
            return true;
        }
        catch
        {
            return false;
        }
    }
 
Back