Error Connecting In Application Code to Database (Yet Test Connection was fine)
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3

Thread: Error Connecting In Application Code to Database (Yet Test Connection was fine)

  1. #1
    Join Date
    Aug 2012
    Posts
    6

    Error Connecting In Application Code to Database (Yet Test Connection was fine)

    Hi. I am using Visual C# Express 2010, Windows XP

    I'm attempting to connect to a database within my application code after performing a successful Test Connection when setting up a new Data Source.

    I'm using one of the database options available from my drop-down menu, I believe SQL Server Express 2010 or something of another. It came with visual C# express and is installed locally.

    When calling [myConnectionVariable].Open() in my application code, I get the following error:
    A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: SQL Network Interfaces, error: 26 - Error Locating Server/Instance Specified)

    What could be causing this? I checked the Settings file and saw something called "Data Source=|DataDirectory|myDataBase.sdf" Am I supposed to change DataDirectory and put in the full directory address, or is there something else causing the server to not be found an accessible?

  2. #2
    VictorN's Avatar
    VictorN is offline Super Moderator Power Poster
    Join Date
    Jan 2003
    Location
    Wallisellen (ZH), Switzerland
    Posts
    17,381

    Re: Error Connecting In Application Code to Database (Yet Test Connection was fine)

    Maybe, you'll find some useful info here?
    Victor Nijegorodov

  3. #3
    Join Date
    Aug 2012
    Posts
    6

    Re: Error Connecting In Application Code to Database (Yet Test Connection was fine)

    Thanks for the reply Victor. I should have posted back a few days ago, but I switched to mysql a few days ago, and have no problem using the mysql library in my program. My database is up and running and I'm connecting to it with the application. My latest progress on the video game I'm making involved setting up a database and writing information from the program to the database, and retrieving information from the database. Going great so far and MySQL has been excellent.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


Windows Mobile Development Center


Click Here to Expand Forum to Full Width

This is a CodeGuru survey question.


Featured


HTML5 Development Center