Question

Hello I am trying to connect my c# application I used this code I found on net but it doest seem to work here is the code

SqlConnection myConnection = new SqlConnection("user id=ayoya;" +
                                   "password=12333;" + 
                                    "server=instance28181.db.xeround.com:18422;" +
                                   "Trusted_Connection=yes;" +
                                   "database=salam;" +
                                   "connection timeout=30;");
        try
        {
            myConnection.Open();

        }
        catch (Exception a)
        {
            Console.WriteLine(a.ToString());
            MessageBox.Show("Failed");
        }

can someone please tell me where I went wrong?

Was it helpful?

Solution

In general, after connecting to the instance creating a DB (using CREATE DATABASE), you must make sure the following parameters contain the correct arguments:

Hostname – See DNS Name in the Details tab; port #– appears by the hostname; username & password – the username and password you provided for the DB instance (also appears in Details tab); database – the name of the DB (NOT the instance name) to which you‘re trying to connect.

Now, more specifically, try the following code to connect your c# application to your xeround DB:

MySqlConnection con = new
  MySqlConnection("Server=instance28181.db.xeround.com;
  Port=18422;Database=salam;Uid=ayoya;Pwd=1233");

Good luck ;)

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top