Friday, February 24, 2012

aspnetdb connection string not found

Why I don't have connection string in web.config for aspnetdb.mdf database although the site works?Help plz?

You could have connection string in web.config,and reference it in your code,take gridview for example:

<asp:SqlDataSource ID="SqlDataSourcel" Runat="server"ProviderName="System.Data.SqlClient"ConnectionString="Server=(local)\SQLExpress;Integrated Security=True;Database=Northwind;Persist Security Info=True"SelectCommand="SELECT [ProductID], [ProductName], [UnitPrice] FROM[Products]"></asp:SqlDataSource>or "SqlDataSource1" runat="server" DataSourceMode="DataReader" ConnectionString="<%$ ConnectionStrings:MyNorthwind%>" SelectCommand="SELECT FirstName, LastName, Title FROM Employees">
In your soucecode you should find ConnectionString .|||The connection string for the database file created in your application is auto generated, you may take a look at this post:http://forums.asp.net/thread/1430985.aspx

No comments:

Post a Comment