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?
Re: Error Connecting In Application Code to Database (Yet Test Connection was fine)
Maybe, you'll find some useful info here?
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.