您的位置:程序门 -> vb ->



让vb程序开机自动运行,却提示“c:\documents and settings\user\中找不到数据库”,求救!


[收藏此页] [打印本页]选择字色:背景色:字体:[][][]


让vb程序开机自动运行,却提示“c:\documents and settings\user\中找不到数据库”,求救!
发表于:2007-10-20 00:40:55 楼主
让vb程序开机自动运行,却提示“c:\documents   and   settings\user\中找不到数据库”,求救!

我的这个程序主要是vb+access+adodc

我的这个软件又不是装在“c:\documents   and   settings\user\”下,怎么会这样提示呢?

哪位大哥帮帮忙?谢谢先!!!


该部分原程序如下:

private   declare   function   regsetvalue   lib   "advapi32.dll"   alias   "regsetvaluea"   (byval   hkey   as   long,   byval   lpsubkey   as   string,   byval   dwtype   as   long,   byval   lpdata   as   string,   byval   cbdata   as   long)   as   long

private   declare   function   regcreatekey   lib   "advapi32.dll"   alias   "regcreatekeya"   (byval   hkey   as   long,   byval   lpsubkey   as   string,   phkresult   as   long)   as   long

private   declare   function   regclosekey   lib   "advapi32.dll"   (byval   hkey   as   long)   as   long

private   declare   function   regdeletevalue   lib   "advapi32.dll"   alias   "regdeletevaluea"   (byval   hkey   as   long,   byval   lpsubkey   as   string)   as   long

private   const   hkey_local_machine   =   &h80000002
private   const   reg_sz   =   1


dim   strstring   as   string
dim   keyhand   as   long

strstring   =   app.path   &   "\"   &   app.exename   &   ".exe"
regcreatekey   hkey_local_machine,   "software\microsoft\windows\currentversion\run",   keyhand
regsetvalue   keyhand,   "",   reg_sz,   byval   strstring,   lenb(strconv(strstring,   vbfromunicode))   +   1
regclosekey   keyhand

open   "calendar2"   for   output   as   #1
write   #1,   "true"
close   #1

发表于:2007-10-20 11:33:471楼 得分:0
问题在于程序内部数据库路径你使用了绝对路径,然后在这个下面没找到access数据库文件
发表于:2007-10-21 14:05:322楼 得分:0
将数据库放在程序目录下,在代码中用app.path   表示程序所在目录
发表于:2007-10-23 09:38:373楼 得分:0
我想到了两种可能:
(1)使用了绝对路径,比如c:\documents   and   settings\user\xxxx.mdb,而安装后的计算机上没有。
(2)难道楼主是在vista系统上运行?(vista有一个虚拟路径的概念,参考vista的uac机制)
发表于:2007-10-25 22:20:114楼 得分:0
vista的版本吧


快速检索

最新资讯
热门点击