473,396 Members | 1,933 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

How do I structure my files so that I don't need to include the full file path?

I am running my project from a USB drive and when I mount the drive, it's not always mounted at the same location.

I get the error message that my database cannot be found when I attempt to run the program.

connection = new OleDbConnection(@"Provider=Microsoft.ACE.OLEDB.12. 0;Data Source=\ExamsHelper\SysDB.accdb");

This is the location, but I get the error message that it cannot be found at C:\ExamsHelper\SysDB.accdb. This is not even where my project is located so I'm not sure why it is looking for it in C:\

Which one of these is sufficient?
Apr 25 '11 #1

✓ answered by GaryTexmo

Where is the executable located? It's running off the USB drive too? That should actually work, I've used relative paths like that before.

If you can't figure it out, see what is stored in Application.StartupPath. You can always use that to build your folder paths.

3 1333
GaryTexmo
1,501 Expert 1GB
Where is the executable located? It's running off the USB drive too? That should actually work, I've used relative paths like that before.

If you can't figure it out, see what is stored in Application.StartupPath. You can always use that to build your folder paths.
Apr 27 '11 #2
All fixed, sorry! I forgot to change the question.
Apr 27 '11 #3
GaryTexmo
1,501 Expert 1GB
If by that you mean you solved it on your own, without my help, please post your solution and pick that as the best answer so people searching through the forums in the future get the correct information ;)

Thanks!

(And glad you got it figured out!)
Apr 27 '11 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

5
by: David Webb | last post by:
The problem started when the Working Folder for a project was somehow set to the folder of another project. I set the correct working folder in VSS and deleted the .vbproj files that had been...
3
by: Wayne Aprato | last post by:
I am using code kindly provided by the Access Web to capture a file path and insert it into a form. The relevant part of the code follows: Function GetOpenFile(Optional varDirectory As Variant,...
4
by: supster | last post by:
I have the full file path of a file stored as a string and I'de like to get the file size in bytes. What is the most efficient way of doing this with a static method from the File class or...
2
by: Susan Baker | last post by:
Hi, I am (trying) to compile some code I downloaded from the internet. The sources contain references to header files - using the form : #include <pathname/file> If I change the form to...
5
by: Sakharam Phapale | last post by:
Hi All, I am using an API function, which takes file path as an input. When file path contains special characters (@,#,$,%,&,^, etc), API function gives an error as "Unable to open input file"....
2
by: Anne DeBlois | last post by:
Hi, We are developing an application based on an MSDE database. We want to create various reports such as a printable catalog that contains pictures. Because our application will ship with over...
10
by: Luke Meyers | last post by:
So, just a little while ago I had this flash of insight. It occurred to me that, while of course in general there are very good reasons for the conventional two-file header/implementation...
3
by: Vibhu | last post by:
Hello All, I have a input box on the HTML page with the type set to file. What I want is that when the value changes in the file textbox, it should give me the full file path. I have even tried...
3
by: Ken | last post by:
I have application files under "C:\$\TestApp". there is a test.xml file under "C:\$\TestApp\test.xml" I made a virtural directory in IIS as "TestApp" currently in application, "Request.MapPath(...
7
by: Ken | last post by:
I have application files under "C:\$\TestApp". there is a test.xml file under "C:\$\TestApp\test.xml" I made a virtural directory in IIS as "TestApp" currently in application, "Request.MapPath(...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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,...
0
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,...
0
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...
0
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...

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.