Click here to Skip to main content
15,909,051 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
public void OpenSqlConnection()
{
  try
  {
    //Database connection properties
    string sConString = "Data Source=192.168.1.10,1433; Network Library=DBMSSOCN; Initial Catalog=MyDatabase;User=Admin;password=pswd";
    //Creating New connection
    MyConn= new SqlConnection(sConString);MyProject.Properties.Settings.Default["MYConnectionString"] = sConString;
    //Open SqlConnection
    if (MyConn.State == ConnectionState.Open) MyConn.Close();
      MyConn.Open();
  }
  catch (Exception ex)
  {
    throw;
  }
}

Why is my program throwing this error?
Posted
Updated 7-Nov-10 22:12pm
v3
Comments
JeremH 8-Nov-10 4:19am    
What is the error?

1 solution

Shouldn't the port be separated from the IP using a colon instead?

192.168.1.10:1433 rather than 192.168.1.10,1433?
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900