Welcome to Dream.In.Code
Become a VB.NET Expert!

Join 150,041 VB.NET Programmers for FREE! Get instant access to thousands of VB.NET experts, tutorials, code snippets, and more! There are 1,592 people online right now. Registration is fast and FREE... Join Now!




Can't connect to database

 
Reply to this topicStart new topic

Can't connect to database

James Bond C++ Spy
28 Feb, 2008 - 07:55 PM
Post #1

D.I.C Head
**

Joined: 3 Oct, 2007
Posts: 81


My Contributions
I am working on a project for VB class. It deals with connecting to a database. I missed one aspect of the assignment and was going to redo it at home. The problem is I can't seem to connect to my .mdf file. I have done this at school several times but I get this error on my laptop where I have SQL Server 2005 installed.

An error has occured 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: 26 - Error Locating
Server/Instance Specified)

How do I change the remote connections setting in SQL Server? Is this the problem? Thanks for any help

User is offlineProfile CardPM
+Quote Post

PsychoCoder
RE: Can't Connect To Database
28 Feb, 2008 - 11:50 PM
Post #2

using DIC.Core;
Group Icon

Joined: 26 Jul, 2007
Posts: 9,483



Thanked: 161 times
Dream Kudos: 9075
Expert In: VB, VB.Net, C#, SQL, ASP, ASP.Net, Web Development, HTML, CSS, Win32 API, Javascript, mySQL, J#, Boo.Net

My Contributions
Why don't you post the code you're using to connect to your database. Without seeing how you're doing it we have no way of telling what could be causing the error. When posting your code please use code tags as it makes it easier to read code.gif

Thanks smile.gif
User is offlineProfile CardPM
+Quote Post

James Bond C++ Spy
RE: Can't Connect To Database
29 Feb, 2008 - 07:49 AM
Post #3

D.I.C Head
**

Joined: 3 Oct, 2007
Posts: 81


My Contributions
There really is no code. I am trying to add a new data base using the data/add new data source from the pull down menu. After I select the .mdf file and click OK I get the error connecting. Thanks
User is offlineProfile CardPM
+Quote Post

James Bond C++ Spy
RE: Can't Connect To Database
1 Mar, 2008 - 10:28 AM
Post #4

D.I.C Head
**

Joined: 3 Oct, 2007
Posts: 81


My Contributions
Can someone PLEASE help me with this problem? Thanks
User is offlineProfile CardPM
+Quote Post

Jayman
RE: Can't Connect To Database
1 Mar, 2008 - 03:30 PM
Post #5

Student of Life
Group Icon

Joined: 26 Dec, 2005
Posts: 7,319



Thanked: 66 times
Dream Kudos: 500
Expert In: Everything

My Contributions
Post the error message that you are getting when you try to add the Data Source to VS.
User is offlineProfile CardPM
+Quote Post

James Bond C++ Spy
RE: Can't Connect To Database
1 Mar, 2008 - 06:49 PM
Post #6

D.I.C Head
**

Joined: 3 Oct, 2007
Posts: 81


My Contributions
This is the error:
QUOTE
An error has occured 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: 26 - Error Locating Server/Instance Specified)


This post has been edited by James Bond C++ Spy: 1 Mar, 2008 - 07:18 PM
User is offlineProfile CardPM
+Quote Post

PsychoCoder
RE: Can't Connect To Database
1 Mar, 2008 - 07:37 PM
Post #7

using DIC.Core;
Group Icon

Joined: 26 Jul, 2007
Posts: 9,483



Thanked: 161 times
Dream Kudos: 9075
Expert In: VB, VB.Net, C#, SQL, ASP, ASP.Net, Web Development, HTML, CSS, Win32 API, Javascript, mySQL, J#, Boo.Net

My Contributions
The reason that this error occurs is the client stack could not receive SSRP response UDP packet from SQL Browser. It's easy to isolate the issue. Here are the steps:
  1. Make sure your server name is correct, e.g., no typo on the name.
  2. Make sure your instance name is correct and there is actually such an instance on your target machine. [Update: Some application converts \\ to \. If you are not sure about your application, please try both Server\Instance and Server\\Instance in your connection string]
  3. Make sure the server machine is reachable, e.g, DNS can be resolve correctly, you are able to ping the server (not always true).
  4. Make sure SQL Browser service is running on the server.
  5. If firewall is enabled on the server, you need to put sqlbrowser.exe and/or UDP port 1434 into exception.


There is one other case where you may still fail after you checked step 1)-4). It happens when:

  • your server is a named instance on cluster or on a multi-homed machine, and
  • your client is a Vista machine with Firewall on.

User is offlineProfile CardPM
+Quote Post

James Bond C++ Spy
RE: Can't Connect To Database
2 Mar, 2008 - 07:29 AM
Post #8

D.I.C Head
**

Joined: 3 Oct, 2007
Posts: 81


My Contributions
Maybe I am not clear in what I am trying to do. The first time I tried to connect to a database I connected to SQL Server on my computer. Now what I need to do is just connect to a .mdf file in the I placed in my project folder. I do not want to connect to SQL Server I just want to connect to a .mdf database file. Thanks
User is offlineProfile CardPM
+Quote Post

Jayman
RE: Can't Connect To Database
2 Mar, 2008 - 09:01 AM
Post #9

Student of Life
Group Icon

Joined: 26 Dec, 2005
Posts: 7,319



Thanked: 66 times
Dream Kudos: 500
Expert In: Everything

My Contributions
Run the Surface Area Configuration Utility found in All Programs -> SQL Server.

There you will find a check box that needs to be checked to Allow Remote Connections. Check it and then click OK.

If it is already checked then post back a reply.
User is offlineProfile CardPM
+Quote Post

Fast ReplyReply to this topicStart new topic
Time is now: 1/8/09 09:53PM

Be Social

Dream.In.Code RSS Feed Dream.In.Code LinkedIn Group Follow Us On Twitter

Live VB.NET Help!

VB.NET Tutorials

Reference Sheets

VB.NET Snippets

DIC Chatroom

Bye Bye Ads

Monthly Drawing

Thumb Drive

Top Contributors

Top 10 Kudos This Month