Wrox Programmer Forums
Go Back   Wrox Programmer Forums > C# and C > C# 2005 > C# 2005
|
C# 2005 For discussion of Visual C# 2005.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the C# 2005 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old September 18th, 2006, 12:38 PM
Authorized User
 
Join Date: Apr 2005
Posts: 23
Thanks: 0
Thanked 0 Times in 0 Posts
Default 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();

    }







Similar Threads
Thread Thread Starter Forum Replies Last Post
Failed to generate a user instance of SQL Server naeem.net SQL Server 2005 3 December 11th, 2009 02:45 PM
SQL Server Reg. SQL Server does not exist error Arsi SQL Server 2000 1 June 11th, 2008 11:20 AM
SQL user instance error ckerin BOOK: Beginning ASP.NET 2.0 BOOK VB ISBN: 978-0-7645-8850-1; C# ISBN: 978-0-470-04258-8 0 April 28th, 2008 12:30 AM
SQL Express User Instance...avoiding aspdewd SQL Server 2005 1 October 27th, 2007 10:12 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.