简体   繁体   中英

I cannot display data from sql server 2005 express on an ASP.net website running from IIS windows 7

I am using Microsoft server 2003 running sql server 2005 which I have added an asp.net website on IIs.This works perfect. I can display the website on the browser and also read information from the sql server. My problem now arises when I want to do exactly the same but with my laptop which is running sql server 2005 express on windows 7. the websites displays just fine on the localhost but when I login it gives me an error saying that it cannot read files. So my question is that is there a difference between sql server connectionstring and sql server express connection string? or the error is not connectionstring related?

Yes, the connection string for SQL Server CE is typically different from SQL Server. SQL Server CE is "self hosted." You basically connect to a file in your app_data directory. SQL Server, in contrast, has many ways to connect to it: via TCP/IP, Named Pipes, etc.

A typical SQL Server connection string is this:

Data Source=myServerAddress;Initial Catalog=myDataBase;User Id=myUsername;Password=myPassword;

A typical SQL Server CE connection string is this:

Data Source=MyData.sdf;Persist Security Info=False;

Notice how for SQL Server CE you specify the path to your database file. For SQL Server, you typically specify the server running the SQL Server Service.

Many more examples here.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM