?
Solved

ASP.NET Connection String

Posted on 2011-09-09
5
Medium Priority
?
345 Views
Last Modified: 2012-05-12
Hello,

I built an ASP.NET C# pages and I used MS Access Database.  Everything worked just fine.
After I published it on the entrant, there is not connection to the database.

I added a connection string to the web.confg, but I forgot how to connect it the the Gridviews I have on the pages.

Any recommendations?

Thank you,
RD11
0
Comment
Question by:RD11
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
5 Comments
 
LVL 10

Accepted Solution

by:
oxyoo earned 668 total points
ID: 36515356
Without seeing you code it's hard to tell... but I would take a look at the firewall and make sure it is not blocking access to the database. Also, is the database and website on the same machine or on two different machines?
0
 

Author Comment

by:RD11
ID: 36515366
On the same server.

Here is the Web.confi before and after I published it:

<?xml version="1.0"?>
<configuration>
	<appSettings/>
	<connectionStrings/>
	<system.web>
		<compilation debug="true">
		</compilation>
		<!--
            The <authentication> section enables configuration 
            of the security authentication mode used by 
            ASP.NET to identify an incoming user. 
        -->
		<authentication mode="Windows"/>
		<!--
            The <customErrors> section enables configuration 
            of what to do if/when an unhandled error occurs 
            during the execution of a request. Specifically, 
            it enables developers to configure html error pages 
            to be displayed in place of a error stack trace.

        <customErrors mode="RemoteOnly" defaultRedirect="GenericErrorPage.htm">
            <error statusCode="403" redirect="NoAccess.htm" />
            <error statusCode="404" redirect="FileNotFound.htm" />
        </customErrors>
        -->
	</system.web>
	<!-- 
        The system.webServer section is required for running ASP.NET AJAX under Internet
        Information Services 7.0.  It is not necessary for previous version of IIS.
    -->
</configuration>

Open in new window

0
 
LVL 84

Assisted Solution

by:Dave Baldwin
Dave Baldwin earned 664 total points
ID: 36515367
Access has to be opened in read/write mode.  That is frequently not allowed on web hosting unless you set it up in special directories with special access permissions.
0
 

Author Comment

by:RD11
ID: 36515370
I am looking for the connection between the connection string and the GridView on all the pages.
0
 
LVL 11

Assisted Solution

by:brutaldev
brutaldev earned 668 total points
ID: 36515432
If you've just lost the conenction string in your config, just add it again:
<connectionStrings>
   <add 
      name="MyAccessDB" 
      connectionString="Provider =Microsoft.Jet.OLEDB.4.0; Data Source =|DataDirectory|\myDatabase.mdb; User Id =admin; Password =;"
   />
</connectionStrings>

Open in new window

Example of possible strings to use with your Access database: http://www.connectionstrings.com/access
0

Featured Post

Free learning courses: Active Directory Deep Dive

Get a firm grasp on your IT environment when you learn Active Directory best practices with Veeam! Watch all, or choose any amount, of this three-part webinar series to improve your skills. From the basics to virtualization and backup, we got you covered.

Question has a verified solution.

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

Entity Framework is a powerful tool to help you interact with the DataBase but still doesn't help much when we have a Stored Procedure that returns more than one resultset. The solution takes some of out-of-the-box thinking; read on!
Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
Visualize your data even better in Access queries. Given a date and a value, this lesson shows how to compare that value with the previous value, calculate the difference, and display a circle if the value is the same, an up triangle if it increased…
In this video, Percona Solution Engineer Dimitri Vanoverbeke discusses why you want to use at least three nodes in a database cluster. To discuss how Percona Consulting can help with your design and architecture needs for your database and infras…
Suggested Courses

765 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