0

I'm trying to connect with C# code to a SQL Server database hosted on gear host using the System.Data.SqlClient library, but it doesn't work, I get an error "Server does not exist or connection refused."

Maybe I need do install some driver? Or is there anything wrong with my code?

string connetionString = "Data Source=mssql.gear.host:1433;Initial Catalog=databasename;User ID=userid;Password=mypassword";
SqlConnection cnn = new SqlConnection(connetionString);

try
{
    cnn.Open();
    Console.WriteLine("Connection Open!");
    cnn.Close();
}
catch (Exception ex)
{
    Console.WriteLine(ex);
}
marc_s
  • 732,580
  • 175
  • 1,330
  • 1,459

1 Answers1

0

when removing the port it works ,obviously the database in gear host doesn't use a port