473,624 Members | 2,026 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Global connection string to Access Databse

i am currently developing an asp.net web application which is linked
to an Access database.

The main problem that i have is in creating a global pathname that i
can access. When i put my string into either the appsettings or a
global settings module i get an error on the server.mappath part of
the string. how can i get round this as i dont want to have to use a
specific path for the web application. it seems that this should be
easy as i can use a relative path in other parts of the system.

I suppose i could set a session state value or application state value
on start up but i hope someone can shed some light on my issue.

thanks in advance

C
Nov 13 '05 #1
1 3792
Colin,

What is the exact error that you get when you try to get the physical
path with Server.MapPath? Also, how are you creating a connection
string? Are you appending the results of your MapPath to the
DataSource part of the connection string?

I always store my connection strings in an appSettings block in my
web.config file. I think that for MS Access, the connection string
(ODBC or OLEDB) requires you to use the physical path for the database,
but I don't see why you couldn't store the location of the database as
a relative path, map it to a physical location and then use the result
to create a connection string.

Bill

Colin Graham wrote:
i am currently developing an asp.net web application which is linked
to an Access database.

The main problem that i have is in creating a global pathname that i
can access. When i put my string into either the appsettings or a
global settings module i get an error on the server.mappath part of
the string. how can i get round this as i dont want to have to use a
specific path for the web application. it seems that this should be
easy as i can use a relative path in other parts of the system.

I suppose i could set a session state value or application state value on start up but i hope someone can shed some light on my issue.

thanks in advance

C


Nov 13 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

7
6566
by: Matt Calhoon | last post by:
Hi there, How does IIS 6.0 treat the global.asa file? I had the following problem; 1. uploaded a new site to the win3k server 2. had incorrect db connection string in Session_OnStart in global.asa and website caused errors. 3. Changed the global.asa file to include the correct details. Saved the file. Still got the same errors.
4
1753
by: Mahesh D. Rane | last post by:
Hi, I am connecting to sql databse from windows C# form. when i close the form, then also the connection to databse is active. Its not allowing me to delete the database. But if i close the complete application, then databse is delete successfully. ANy solution ? Regards,
8
1719
by: Jim | last post by:
I want to store a database connection (includes username & password) for my asp.net app, currently I have it stored in the web.config file - I know this is not ideal but can anyone suggest a better place or way to store it. Cheers Eath Worm Jim
2
3518
by: PRTC | last post by:
I'm trying to use the global.asax in my new web aplication proyect using the Application start to store my connection string GLOBAL.ASAX.vb Sub Application_Start(ByVal sender As Object, ByVal e As EventArgs) Dim objConnection As OleDbConnection Dim daContent As OleDbDataAdapter Dim objDataReader As OleDbDataReader
12
3809
by: John M | last post by:
Hello, On Microsoft Visual Studio .NET 2003, I want to use some global elements, that can be used in each one of my pages. i.e I put a oleDBConnection on global.asax.vb How can I use it (the oleDBConnection on global.asa.vb) at the other aspx pages ?
4
2575
by: Sylvain | last post by:
Hi ! Here's my problem: I have actually an asp web site which use the global.asa file to connect to the database but for security reason, I want to put username and password information (or the complete connection string) in a seperate file so only a special user could read these informations. Is someone knows how to do this ?
1
2874
by: Daniel Friend | last post by:
I am trying to add the following as my global.asax file in vb. I am getting errors like crazy. They are as follows * Error 1 There can be only one 'application' directive. * Error 4 Validation (ASP.Net): This attribute name must be followed by an equal (=) sign and a value. If the value is in quotation marks, the quotation marks must match. * Error 5 Validation (ASP.Net): Attribute 'Implements' is not a valid attribute of element...
35
4828
by: Terry Jolly | last post by:
Web Solution Goal: Have a global database connection Why: (There will be 30+ tables, represented by 30+ classes) I only want to reference the database connection once. I put the connection string in the web.config. I created a class with a static database connection and the class opens and closes the database.
1
1350
by: Horia Demian | last post by:
I have the following code in a web form which use a connection to SQL Server 2000. I use this form to display a list of products from a table. The connection string to the database server is stored in web.config file. public partial class VizualizareProduse : System.Web.UI.Page { protected SqlConnection con;//conexiunea spre baza de date protected void Page_Load(object sender, EventArgs e) {
0
8238
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8174
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8680
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8624
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8336
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8478
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
6111
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
1
2607
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1786
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.