I tried dragged and dropped an SqlDataSource and then click "Configure Data Source". From there i start a new connection and select my server. Under "Select and enter a database name" listbox i can not see anything. So i try to attach a database file "NORTHWND.MDF". When i try to test the connection it always fails. What might be the problem. I allowed remote connections but did not install IIS yet. Might that be the problem?

VS.NET 2005

Thanks for replies.

8 Years
Discussion Span
Last Post by Xessa

What is the error message you receive? If you can connect but not list the database it might be a permissions error. By default IIS runs as a non-privelaged users and you either need to use SQL Authentication and add a user to your SQL Server, and add the username and password to the connection string with integrated security = false. Most likely if you can connect then the user is setup but has no explicit permissions.

You can also (but not advised) setup identity impersonate in your web.config file and run as a privelaged users, which should have access to the sql server


Oops, missed the part about IIS not being installed and you're experiencing this in the IDE. What is the error from the test connection? If it cannot establish a connection then it might be with the server, if it cannot attach to the database then it might be a permissions issue.


Thanks for your help.

Now i am telling what i'm trying to do step by step.

1- From the SqlDataSource from the design view which i dragged and dropped, i click "Configure Data Source".

2- I click "New Connection"

3- Data Source: Microsoft SQL Server(Sql Client)
Server Name: "[my server's name]"
Windows Authentication radio button is clicked

4-Select or enter a database name: Since the listbox does not give anyname to me as a result, it forces me to attach a database file. So i click the "browse" button and select NORTHWND.MDF(could not find it before so downloaded it) And i leave the "logical name" textbox empty.

5-I click "Test Connection" button.

RESULT = "An error occured while establishing 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)

PS: No IIS is installed.


That error is connecting to the SQL Server, not a database issue. Is this a full version of SQL or the express version? By default network connections are not allowed IIRC in the express version unless specifically set. The error log on the machine running the SQL Server may have more detailed information


Thanks for your kindness of helping me.

I solved the problem at last.
I learned that i had to write ".\SQLExpress" for my server name.

This solved my problem.

Now i am proud to say that the problem is solved!!!:twisted:

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.