Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Moving an SQL application to SQL2005 Express

Status
Not open for further replies.

iipee

Programmer
Mar 23, 2006
6
0
0
FI
I have been programming an application with VC++ 2005 and SQL Server 2005. I have converted an old 16-bit database for 32-bit managed code and SQL server and the application seems to be good. Now I want to deploy the application to another server for testing.

I have installed XP SP2, Windows Installer 3.1, Net framework 2.0 and SQL Server 2005 express to the test server. I have transferred the application with WI 3.1 and the program works well in the test server till the first SQL command. I have made a back up of the database and restored it in the test server. In the test server I can log in the database with Server Management studio and I can read the data there quite correctly. I have enabled both named pipes and TCP/IP for the database in the test server. With Surface Area Configuration I have enabled Local and Remote Connections Using both TCP/IP and named pipes. I only need Windows authentication at this time.

After all this when I come to the first SQL command in the application on the test server I receive 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: Named Pipes Provider, error: 40 – Could not open a connection to SQL Server).

My connection string to the database is:
'connection->ConnectionString = "Persist Security Info=False; Integrated Security =SSPI;"
"Data Source=TESTSERVER; Initial Catalog=TESTDATABASE;";'

When I use "Data Source=DevelopmentServer", the application works well on the development server.

Can't understand what is still wrong. Can anyone possibly have an answer?

 
Finally found the solution as there was an error in the command string. In SQLExpress server the data source must be presented in format SERVER\SQLExpress. When this is part of the above C++ command string it must have the format

"Data Source=TESTSERVER\\SQLExpress; Initial Catalog=TESTDATABASE;";

although the backslash is within quotation marks.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top