Solved

ASP.NET Connection String

Posted on 2011-09-09
5
331 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
5 Comments
 
LVL 10

Accepted Solution

by:
oxyoo earned 167 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 83

Assisted Solution

by:Dave Baldwin
Dave Baldwin earned 166 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 167 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

3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

Question has a verified solution.

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

For those of you who don't follow the news, or just happen to live under rocks, Microsoft Research released a beta SDK (http://www.microsoft.com/en-us/download/details.aspx?id=27876) for the Xbox 360 Kinect. If you don't know what a Kinect is (http:…
This article shows how to deploy dynamic backgrounds to computers depending on the aspect ratio of display
Windows 10 is mostly good. However the one thing that annoys me is how many clicks you have to do to dial a VPN connection. You have to go to settings from the start menu, (2 clicks), Network and Internet (1 click), Click VPN (another click) then fi…
Learn how to create flexible layouts using relative units in CSS.  New relative units added in CSS3 include vw(viewports width), vh(viewports height), vmin(minimum of viewports height and width), and vmax (maximum of viewports height and width).

863 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

Need Help in Real-Time?

Connect with top rated Experts

23 Experts available now in Live!

Get 1:1 Help Now