Click here to Skip to main content
11,803,019 members (78,228 online)
Rate this: bad
Please Sign up or sign in to vote.
See more: VB VB.NET
I have one database file "ABC.mdb" that is in DATABASE folder..This database folder is in Projects folder "Milkat"...Now what I need is,this MILKAT named folder can be placed on any drive..On Windows server 2003,The code I used runs perfect but when I copy on clients PC the same folder,error occurs saying "File not found".Below is the code to Find path of file and store it in variable..
'If IO.File.Exists("..\..\Database\ABC.mdb") Then
        '    PathDB = "..\..\Database\ABC.mdb"
        '    MsgBox("This path does not contain database.")
        '    Exit Sub
        'End If

Please help me..
Posted 21-Mar-13 1:06am

1 solution

Rate this: bad
Please Sign up or sign in to vote.

Solution 1

This error is caused by the use of relative paths, I suppose. Check if the relative path of the DB is the same on the client system and on the development folder.

Marco Bertschi
Rachna0309 at 21-Mar-13 7:27am
On development PC it is,E:\Projects\Database\ABC.mdb
and On Client system it is,C:\Milkat\Database\ABC.mdb
Marco Bertschi at 21-Mar-13 7:29am
And where is the executable located?
Rachna0309 at 21-Mar-13 7:31am
On clients PC it is in C:\Milkat
On development it is in E:\Projects\bin
Rachna0309 at 21-Mar-13 7:36am
Is there any better way to get path of file??
Marco Bertschi at 21-Mar-13 7:37am
The Problem is that your exe is located on different places related to the database on client and dev machine.
Changing the exe's location to C:\Milkat\bin on the client machine should you help solving the problem.
Rachna0309 at 21-Mar-13 7:40am
But as far as I know,relative path means we dont need to specify all folders name
Marco Bertschi at 21-Mar-13 8:15am
Yes. But in your case, the realtivity of the exe and the DB has changed. Your exe is looking for the db at "C:\Milkat" and not "C:\Milkat\Database" on the client machine.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 KrunalRohit 356
1 OriginalGriff 335
2 CPallini 270
3 F-ES Sitecore 270
4 Sergey Alexandrovich Kryukov 234
0 OriginalGriff 2,950
1 Maciej Los 1,910
2 KrunalRohit 1,862
3 CPallini 1,735
4 Richard MacCutchan 1,157

Advertise | Privacy | Mobile
Web04 | 2.8.151002.1 | Last Updated 21 Mar 2013
Copyright © CodeProject, 1999-2015
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100