Solved

ASP.NET Connection String

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

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

What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
asp.net bundle 8 36
DataGridview Currency Formating? 22 38
Chat Room 1 26
File Upload Control on a ASP.NET Overlay Page 1 20
IntroductionWhile developing web applications, a single page might contain many regions and each region might contain many number of controls with the capability to perform  postback. Many times you might need to perform some action on an ASP.NET po…
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:…
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.

708 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

12 Experts available now in Live!

Get 1:1 Help Now