Access to database and connection string
This is my connection string:
<add name="modelConnectionString" connectionString="Data Source=.\SQLEXPRESS;AttachDbFilename='D:\Documents and Settings\Dima\My Documents\Visual Studio 2010\WebSites\WebSite10\App_Data\ASPNETDB.MDF';Integrated Security=True;User Instance=True;" providerName="System.Data.SqlClient"/>
It stop开发者_如何学JAVAped throwing exceptions, but the access to the database doesnt seem to work, cause when i answer the confirmation question, it says it is wrong and wont let me in!!
<membership defaultProvider="MyMembershipProvider">
<providers>
<clear/>
<add
name="MyMembershipProvider"
type="System.Web.Security.SqlMembershipProvider"
connectionStringName="modelConnectionString"
minRequiredPasswordLength="1"
minRequiredNonalphanumericCharacters="0"
enablePasswordReset="true"
maxInvalidPasswordAttempts="1000"
passwordAttemptWindow="4000"
enablePasswordRetrieval="true"
requiresUniqueEmail="false"
passwordFormat="Encrypted"
applicationName="/WebSite10"
/>
</providers>
</membership>
You haven't specified a database name in the connection string - in the top one you are specifying the database file where you should be declaring the database name.
Server=.\SQLExpress;AttachDbFilename=c:\asd\qwe\mydbfile.mdf;Database=dbname; Trusted_Connection=Yes;
If you're attaching a database file to a local instance of SQL then you need to use the AttachDbFilename
property.
Can you not create the connection through the Visual studio server explorer. You can log into the server using the correct credentials then save the correct connection string to the config file.
There is a microsoft knowledge base article! on this.
精彩评论