Connection to SQL Server 2005 database from VB 2005 Express problem, please help
Dear All,
I am beginner. I wanted to create a connection from VB 2005 Express to a database created with SQL Server 2005.
From the project I did this:
Add new data source, -> database -> New Connection -> Browse got the .mdf file, then click on OK, after waiting the following error occurs:
"An error has occured while establishing a connection with 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)
I can't find how to correct this, please help! Note that I use SQL Server 2005
(not express).
Thank you in advance,
Nikosgeo
Connection to SQL Server 2005 from VB 2005 Express more details
Thank you for your answers.
Unfortunately, the Data Source has .\MSSQLSERVER or .\SQLEXPRESS to choose from and .\MSSQLSERVER does not solve the problem.
The .mdf file is in the following path (local hard disk):
C:\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\Data\
It may be something basic, since I am beginner.
This time the error message was different:
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: 25 - Connection string is not valid)
SQL Server Connection Configration
Hello,
Ensure that you have configured the SQL Server 2005 Listeners. By default SQL Server 2005 is locked down and needs TCP/IP enabled. You may need choose Shared Memory or Named Pipes to connect to SQL in VS2005
Make sure that SQL Server 2005 services are running too.
All these options and services can be found in the "SQL Server Configuration Manager"
- SQL Svr 2005 Network Configuration/Protocols for MSSQLSERVER
- Services (Stop and Start Services)
connecting from within VB express
When you try to connect from within VB Express, you have to specify your server as Computer Name\sqlexpress.
So if your computer is named Frank, you would specify the server as Frank\sqlexpress.
Very important.
Viv
Make sure that SQL service is running
First try making sure that the service is running.
On Win XP, go to the My Computer icon, right click, choose manage,
and in the services and applications folder, click the services entry,
and look for SQLEXPRESS.
Right click it and choose the start option.
Then you can try to connect to the SQLEXPRESS db using the SQL Server Management Studio Express Edition free program from Microsoft. This is where you would type in the computer_name\sqlexpress for the db connection.
default name should be sqlexpress
In the install, the default name should already by sqlexpress if you are installing sql server 2005 express...