Solved

ASP.NET Connection String

Posted on 2011-09-09
5
333 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

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 …
Real-time is more about the business, not the technology. In day-to-day life, to make real-time decisions like buying or investing, business needs the latest information(e.g. Gold Rate/Stock Rate). Unlike traditional days, you need not wait for a fe…
Email security requires an ever evolving service that stays up to date with counter-evolving threats. The Email Laundry perform Research and Development to ensure their email security service evolves faster than cyber criminals. We apply our Threat…
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…

776 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