Forbindelse til MS-SQL
Jeg får beskeden: System.Data.SqlClient.SqlException: SQL Server does not exist or access denied. at System.Data.SqlClient.ConnectionPool.GetConnection(Boolean& isInTransaction)Men jeg ved databasen eksisterer, og at min workstation har det navn.
DBen er en MSDE
kode:
_________________________
string strConnection = "Integrated Security=SSPI;";
strConnection += "initial catalog=PhoneReg;server=PC-WS-WORK-001";
strConnection += "Connect Timeout=30";
lblDatasrc.Text = strConnection;
SqlConnection objConnection = new SqlConnection(strConnection);
try
{
objConnection.Open();
lblConOpen.Text = "Connection opened successfully";
objConnection.Close();
lblConClose.Text = "Connection Closed!";
}
catch (Exception b)
{
lblConOpen.Text = "Connection failed to open!";
lblConClose.Text = b.ToString();
}