Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > C# and C > C# 2005 > C# 2005
Password Reminder
Register
Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
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 tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developersí questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Display Modes
  #1 (permalink)  
Old September 18th, 2006, 01:38 PM
Authorized User
 
Join Date: Apr 2005
Location: Vancouver, , Canada.
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();

    }


Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off

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 12:20 PM
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 01:30 AM
SQL Express User Instance...avoiding aspdewd SQL Server 2005 1 October 27th, 2007 11:12 PM



All times are GMT -4. The time now is 06:20 PM.


Powered by vBulletin® Version 3.7.0
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.