Foxtable(狐表)用户栏目专家坐堂 → 添加附件问题


  共有2528人关注过本帖平板打印复制链接

主题:添加附件问题

帅哥哟,离线,有人找我吗?
drcqh
  1楼 | QQ | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:小狐 帖子:326 积分:3723 威望:0 精华:0 注册:2013/1/7 17:39:00
添加附件问题  发帖心情 Post By:2014/11/21 18:20:00 [只看该作者]

BeforeConnectOuterDataSource事件中有如下代码:

Dim ipfile As String = projectpath & "ip.txt"   '定义Ipfile为配置文件
If filesys.FileExists(ipfile) = True Then     '先检测是否有Ip.txt这个配置文件
    Dim dbfile As String = filesys.ReadAllText(ipfile)  '将dbfile定义为配置文件的内容,即数据库的路径
    If filesys.FileExists(dbfile) = True Then    '若指定的数据库存在
        If e.name ="Access" Then
            e.C & dbfile & ";Persist Security Info=False"  

        End If
    Else    '若配置文件里的内容的指向不正确,即没有找到数据库文件
        If e.name ="Access" Then
            Dim dlg As new OpenFileDialog
            dlg.Filter = "Access文件|*.mdb"
            If dlg.ShowDialog = DialogResult.OK Then
                e.C & dlg.filename & ";Persist Security Info=False"
                filesys.WriteAllText(ipfile,dlg.filename,False)
            End If
        End If
    End If
Else   
    If e.name = "Access" Then
        Dim dlg As new OpenFileDialog
        dlg.Filter = "Access文件|*.mdb"
        If dlg.ShowDialog = DialogResult.OK Then
            e.C & dlg.filename & ";Persist Security Info=False"
            filesys.WriteAllText(ipfile,dlg.filename,False)
        End If
    End If
End If

在项目文件发布时把IP.txt文件添加到了附件中,但执行发布后的项目时,还是要选数据库文件。如果把IP.txt文件复制到publish文件夹里就能正常打开。请问老师这是为什么?


 回到顶部
总数 11 1 2 下一页