SQL Error Locating Server/Instance Specified
Seems that this error has several conditions:
This is the error message:
An error has occurred while establishing a connection to the server. When connecting to SQL Server 2005, this failure may be caused by the fact that under the default settings SQL Server does not allow remote connections. (provider: SQL Network Interfaces, error: 26 - Error Locating Server/Instance Specified)
Configuration:
SQL 2000
2000 Pro
Visual Studio C# 2005 Express
I have confirmed that the protocols TCP/IP & NamedPipes have been enabled. Is there anything else someone can help me with to get a connection to the datasource?
this is the code:
class Program
{
static void Main(string[] args)
{
// Specify SQL Server-specific connection string
SqlConnection thisConnection = new SqlConnection(
@"Server=(local)\SOHO;Integrated Security=True;" +
"Database=tkdatawarehouse");
// Create DataAdapter object
SqlDataAdapter thisAdapter = new SqlDataAdapter(
"SELECT siteid, vslname FROM tksiteid", thisConnection);
// Create DataSet to contain related data tables,rows,columns
DataSet thisDataSet = new DataSet();
// Fill DataSet using query defined previously for DataAdapter
thisAdapter.Fill(thisDataSet, "Customers");
foreach (DataRow theRow in thisDataSet.Tables["Customers"].Rows)
{
Console.WriteLine(theRow["siteid"] + "\t" + theRow["vslname"]);
}
thisConnection.Close();
Console.Write("Program finished, press Enter/Return to continue:");
Console.ReadLine();
}
|