[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

change web.config connections from sql to access

Posted on 2011-10-04
5
Medium Priority
?
219 Views
Last Modified: 2012-05-12
In code-snippet is the standard code to connect to a sql database. How do I change this code that it works with ms access ?
I know the connction string is eg <!--      <add name="ApplicationServices" connectionString="~/App_data/aspnetdb.mdb" providerName="System.Data.OleDb"/>-->

 but what about the rest ?


<configuration>
	<connectionStrings>
		 <add name="ApplicationServices"
         connectionString="data source=.\SQLEXPRESS;Integrated Security=SSPI;AttachDBFilename=|DataDirectory|\aspnetdb.mdf;User Instance=true"
         providerName="System.Data.SqlClient" />  
		</connectionStrings>
	<system.web>
		<compilation debug="true" targetFramework="4.0"/>
		<authentication mode="Forms">
			<forms loginUrl="~/Account/Login.aspx" timeout="2880"/>
		</authentication>
		<membership>
			<providers>
				<clear/>
				<add name="AspNetSqlMembershipProvider" type="System.Web.Security.SqlMembershipProvider" connectionStringName="ApplicationServices" enablePasswordRetrieval="false" enablePasswordReset="true" requiresQuestionAndAnswer="false" requiresUniqueEmail="false" maxInvalidPasswordAttempts="5" minRequiredPasswordLength="6" minRequiredNonalphanumericCharacters="0" passwordAttemptWindow="10" applicationName="/"/>
			</providers>
		</membership>
		<profile>
			<providers>
				<clear/>
				<add name="AspNetSqlProfileProvider" type="System.Web.Profile.SqlProfileProvider" connectionStringName="ApplicationServices" applicationName="/"/>
			</providers>
		</profile>
		<roleManager enabled="false">
			<providers>
				<clear/>
				<add name="AspNetSqlRoleProvider" type="System.Web.Security.SqlRoleProvider" connectionStringName="ApplicationServices" applicationName="/"/>
				<add name="AspNetWindowsTokenRoleProvider" type="System.Web.Security.WindowsTokenRoleProvider" applicationName="/"/>
			</providers>
		</roleManager>
	</system.web>
	<system.webServer>
		<modules runAllManagedModulesForAllRequests="true"/>
	</system.webServer>
</configuration>

Open in new window

0
Comment
Question by:dekempeneer
  • 2
4 Comments
 
LVL 17

Expert Comment

by:Carlos Villegas
ID: 36909460
The best place for connection string details:
http://www.connectionstrings.com/

Access:
http://www.connectionstrings.com/access

Access 2007:
http://www.connectionstrings.com/access-2007

Look for .NET Framework Data Provider
0
 

Author Comment

by:dekempeneer
ID: 36909607
Yes, the connectionstring  ave, but I think I need to replace the System.Web.Security.SqlRoleProvider and such as well ?
0
 
LVL 17

Accepted Solution

by:
Carlos Villegas earned 2000 total points
ID: 36909666
mmm I see, sorry but .net currently dont have a native RoleProvider class for OleDb, you must create a custom one that inherit from System.Web.Security.RoleProvider to interact with your Access DB.

System.Web.Security.RoleProvider reference:
http://msdn.microsoft.com/en-us/library/system.web.security.roleprovider.aspx

You can see an example of how to implement that here:
http://msdn.microsoft.com/en-us/library/317sza4k.aspx (example for odbc but adaptable to OleDb)
http://forums.asp.net/t/1522507.aspx/1 (OleDb, based in the first link)
0
 
LVL 19

Expert Comment

by:Amandeep Singh Bhullar
ID: 37936074
This question has been classified as abandoned and is closed as part of the Cleanup Program. See the recommendation for more details.
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Problem Hi all,    While many today have fast Internet connection, there are many still who do not, or are connecting through devices with a slower connect, so light web pages and fast load times are still popular.    If your ASP.NET page …
International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
In a question here at Experts Exchange (https://www.experts-exchange.com/questions/29062564/Adobe-acrobat-reader-DC.html), a member asked how to create a signature in Adobe Acrobat Reader DC (the free Reader product, not the paid, full Acrobat produ…
This lesson discusses how to use a Mainform + Subforms in Microsoft Access to find and enter data for payments on orders. The sample data comes from a custom shop that builds and sells movable storage structures that are delivered to your property. …
Suggested Courses

872 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question