如何在任何驱动器上查找文件的路径 [英] How to find path of a file on any drive
本文介绍了如何在任何驱动器上查找文件的路径的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有一个数据库文件ABC.mdb位于DATABASE文件夹中。这个数据库文件夹位于Projects文件夹Milkat...现在我需要的是,这个MILKAT命名文件夹可以放在任何驱动器上。 。在Windows Server 2003上,我使用的代码运行完美,但是当我在客户端PC上复制相同的文件夹时,会出现错误,说找不到文件.Below是查找文件路径并将其存储在变量中的代码..
' 如果IO.File.Exists(.. \\ \\Database\ABC.mdb)然后
' PathDB = .. \..\Database\ABC.mdb
' Else
' MsgBox(此路径不包含数据库。)
' 退出子
' 结束如果
请帮助我..
解决方案
我想这个错误是由使用相对路径引起的。检查客户端系统和开发文件夹中DB的相对路径是否相同。
欢呼,
Marco Bertschi
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"
'Else
' MsgBox("This path does not contain database.")
' Exit Sub
'End If
Please help me..
解决方案
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.
cheers,
Marco Bertschi
这篇关于如何在任何驱动器上查找文件的路径的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文