Click here to Skip to main content
15,892,005 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Dear all ,

I am new to ASP and would like to replace my existing web config access AspDB connection to Sql management studio connection . I have used Microsoft server migration assistant and exported the existing access AspDB to Microsoft server management studio 2012 and then executed asp_regsql in my c drive without any errors.

The existing ASP.DB is working fine and was given at College and would like to implement my own using Sql in app data and expand my database .

I have searched and implemented different recommendations from other sites but to no avail and I am stuck. This is my sql database connection properties " Data Source=(localdb)\v11.0;Initial Catalog=VolbankCharity;Integrated Security=True"


My existing Access web config.

XML
  <connectionStrings>
    <add name="LocalAccessDatabase" connectionString="~/App_Data/ASPNetDB.mdb"
      providerName="System.Data.OleDb" />
    <add name="ConnectionString" connectionString="Provider=Microsoft.Jet.OLEDB.4.0;Data Source=|DataDirectory|\ASPNetDB.mdb;Persist Security Info=True"
      providerName="System.Data.OleDb" />
    <add name="VolBankProjectConnectionString" connectionString="Data Source=(localdb)\v11.0;Initial Catalog=VolBankProject;Integrated Security=True"
      providerName="System.Data.SqlClient" />
  </connectionStrings>
  <system.web>
    <membership defaultProvider="AccessMembershipProvider">
      <providers>
        <clear/>
        <add name="AccessMembershipProvider" type="Samples.AccessProviders.AccessMembershipProvider" connectionStringName="LocalAccessDatabase" enablePasswordRetrieval="false" enablePasswordReset="false" requiresUniqueEmail="true" requiresQuestionAndAnswer="true" minRequiredPasswordLength="1" minRequiredNonalphanumericCharacters="0" applicationName="SampleSite" hashAlgorithmType="SHA1" passwordFormat="Hashed"/>
      </providers>
    </membership>
    <roleManager enabled="true" defaultProvider="AccessRoleProvider" cacheRolesInCookie="true" cookieName=".ASPXROLES" cookieTimeout="30" cookiePath="/" cookieRequireSSL="false" cookieSlidingExpiration="true" cookieProtection="All">
      <providers>
        <add name="AccessRoleProvider" type="Samples.AccessProviders.AccessRoleProvider" connectionStringName="LocalAccessDatabase" applicationName="SampleSite"/>
      </providers>
    </roleManager>
    <profile enabled="True" defaultProvider="AccessProfileProvider">
      <providers>
        <add name="AccessProfileProvider" type="Samples.AccessProviders.AccessProfileProvider" connectionStringName="LocalAccessDatabase" applicationName="SampleSite"/>
      </providers>
      <properties>
        <add name="Forename" type="System.String"/>
        <add name="LastName" type="System.String"/>
        <add name="Telephone" type="System.String"/>
        <add name="Email" type="System.String"/>
      </properties>
    </profile>
    <authentication mode="Forms"/>
    <compilation debug="true" targetFramework="4.0">
      <assemblies>
        <add assembly="System.Web.DynamicData, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
        <add assembly="System.Web.Extensions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
        <add assembly="System.Web, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A"/>
        <add assembly="System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
        <add assembly="System.Core, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
        <add assembly="System.ComponentModel.DataAnnotations, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
        <add assembly="System.Data.Linq, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
        <add assembly="System.Data.Entity, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
        <add assembly="System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A"/>
        <add assembly="System.Data, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
        <add assembly="System.Web.Entity, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
        <add assembly="System.Xml.Linq, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
        <add assembly="System.ServiceModel.Activation, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
        <add assembly="System.Runtime.Serialization, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
        <add assembly="System.Web.ApplicationServices, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
        <add assembly="System.Configuration, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A"/>
        <add assembly="System.ServiceModel, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
        <add assembly="System.Xml, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
        <add assembly="System.Web.Services, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A"/>
        <add assembly="System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
        <add assembly="System.Data.Services.Client, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
        <add assembly="System.Data.Services.Design, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
        <add assembly="System.Design, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A"/>
      </assemblies>
    </compilation>
    <siteMap defaultProvider="XmlSiteMapProvider">
      <providers>
        <clear/>
        <add name="XmlSiteMapProvider" type="System.Web.XmlSiteMapProvider" siteMapFile="Web.sitemap" securityTrimmingEnabled="true"/>
      </providers>
    </siteMap>
    <pages controlRenderingCompatibilityVersion="3.5" clientIDMode="AutoID"/>
  </system.web>
</configuration>">


Many thanks in advance for any assistance or guide rendered .
Posted
Updated 10-Aug-15 9:46am
v2
Comments
Layman22 10-Aug-15 13:31pm    
Aravinda ,

I am getting "System.Configuration.ConfigurationErrorsException: Sections must only appear once per config file." My sql database is connected to Asp.net Database explorer and I have used the instance connection string properties in my web config without success.

I just want to attach my sql database to app data folder within my project and implement new sql connection strings for roles and memberships.
Layman22 10-Aug-15 13:38pm    
Aravinda,

I will implement your recommendations.

1 solution

Hi What error u get ?
ur database name is correct ?

XML
Initial Catalog=VolbankCharity  or
 Initial Catalog=VolbankProject


If correct means then try to change this line
XML
<add name="ConnectionString" connectionString="Provider=Microsoft.Jet.OLEDB.4.0;Data Source=|DataDirectory|\ASPNetDB.mdb;Persist Security Info=True"
providerName="System.Data.OleDb" />

To
<add name="ConnectionString" connectionString="data source=.\v11.0;Integrated Security=SSPI;AttachDBFilename=|DataDirectory|\aspnetdb.mdf;User Instance=true" providerName="System.Data.SqlClient" />


U have instance like this v11.0 ? In Sql Sever Management Studio can login with windows and asp authentication ?

If u still getting problem then rename the existing webconfig file and add newly config file and add connection string .
 
Share this answer
 
v4
Comments
[no name] 10-Aug-15 13:24pm    
Some yyyyyyyyyyyyyy and oooooooooooooooo from my side. You can use them next time. Inform me when you are again out of them :)
And yes I let also a 5 here.
Aravindba 10-Aug-15 21:12pm    
thanks
Layman22 10-Aug-15 13:49pm    
Aravinda,

I did replaced the code but the website configuration tool threw another error
"There is a problem with your selected data store. This can be caused by an invalid server name or credentials, or by insufficient permission. It can also be caused by the role manager feature not being enabled. Click the button below to be redirected to a page where you can choose a new data store."

"The following message may help in diagnosing the problem: Connection string not found: LocalAccessDatabase"

Role manager is enabled as posted in my question .
Aravindba 10-Aug-15 21:16pm    
Thats why i ask to add new web config,add one by one what u needs.
http://stackoverflow.com/questions/10251979/asp-net-membership-and-role-provider-config-issue
http://forums.asp.net/t/1916580.aspx?roleManager+in+web+config+causes+error+in+configuration+tool

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900