Create Database Connection in the C#.net


DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 3 of 3

Thread: Create Database Connection in the C#.net

  1. #1
    Join Date
    Nov 2007
    Posts
    45

    Create Database Connection in the C#.net

    hello all,

    I have database named 'Marketing', and want to bound DropDownList control with it using 'add connection' dialog box in the C#.net.

    I gave datasource: 'Microsoft SQL Server Database File (SqlClient)'. And when I give DataBase file name as 'C:\Program Files\Microsoft SQL Server\MSSQL\Data\Marketing_Data.MDF', I get error while testing the connection:
    "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 default settings SQL Server dose not allow remote connections. (Provider:SQL Network Interfaces, error: 26-Error Locating Server/Instance specified)".

    So what DataBase File name I should give here for completing the database binding?

    Thanks

  2. #2
    Join Date
    Apr 2007
    Location
    Sterling Heights, Michigan
    Posts
    8,666
    Well, first you need to ensure the database is setup to accept remote connections.

    By default, it is not.
    I don't answer coding questions via PM or Email. Please post a thread in the appropriate forum section.
    Please use [Code]your code goes in here[/Code] tags when posting code.
    Before posting your question, did you look here?
    Got a question on Linux? Visit our Linux sister site.
    Modifications Required For VB6 Apps To Work On Vista

  3. #3
    Join Date
    Nov 2003
    Location
    Portland, OR
    Posts
    8,387
    Ignore the error message; if you're running SQL on the same computer as your application, your problem has nothing to do with remote connections.

    Which version of SQL are you using? Is it SQL 2005 Express, or SQL Server? What does your connection string look like?
    Phil Weber
    http://www.philweber.com

    Please post questions to the forums, where others may benefit.
    I do not offer free assistance by e-mail. Thank you!

Similar Threads

  1. Java and MS access database connection
    By borceivanovski in forum Java
    Replies: 1
    Last Post: 04-27-2005, 05:35 PM
  2. Replies: 1
    Last Post: 11-18-2002, 08:45 AM
  3. Getting a GUI to function
    By Eric in forum Java
    Replies: 1
    Last Post: 11-27-2001, 06:53 AM
  4. Replies: 0
    Last Post: 06-28-2001, 03:08 PM
  5. Replies: 0
    Last Post: 04-25-2001, 06:51 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center