Foxtable(狐表)用户栏目专家坐堂 → BeforeConnectOuterDataSource中的全局变量不能执行吗


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

主题:BeforeConnectOuterDataSource中的全局变量不能执行吗

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


加好友 发短信
等级:小狐 帖子:341 积分:2455 威望:0 精华:0 注册:2014/7/30 18:03:00
BeforeConnectOuterDataSource中的全局变量不能执行吗  发帖心情 Post By:2015/12/29 15:49:00 [只看该作者]

全局代码中设置了:
'判断是否连接数据库成功
Public isconnected As Boolean

BeforeConnectOuterDataSource事件中写了:这个代码

If e.Name = "ERPdatabase" Then
    Dim pathP As String = "System/DatabasePath"
    Dim xmlDoc As New System.XML.XmlDocument
    xmlDoc.Load(config)
    Dim xmlNd As System.XML.XmlNode = xmlDoc.SelectSingleNode(pathP)
    Dim databasePath As String = xmlNd.InnerText
  MessageBox.show(databasePath)  
    Dim pathN As String = "System/DatabaseName"
    Dim xmlNd1 As System.XML.XmlNode = xmlDoc.SelectSingleNode(pathN)
    Dim databaseName As String = xmlNd1.InnerText
      MessageBox.show(databaseName )  
    Dim pathPS As String = "System/DatabasePassword"
    Dim xmlNd2 As System.XML.XmlNode = xmlDoc.SelectSingleNode(pathPS)
    Dim databasePassword As String = xmlNd2.InnerText
 MessageBox.show(databasePassword )     
    Dim s As String = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & databasePath & "\" & databaseName & ";Persist Security Info=False;Jet OLEDB:Database Password=" & databasePassword
     MessageBox.show(s)
MessageBox.show(Connections.TryConnect(s))
If Connections.TryConnect(s) = False Then
        MessageBox.Show("数据源无法连通!")
MessageBox.show(1)
        e.HideSplashForm = True
MessageBox.show(2)
        isconnected= False
MessageBox.show(3)
    Else
MessageBox.show(4)
        isconnected= True
MessageBox.show(5)
        e.ConnectionString = s

    End If
MessageBox.show(e.ConnectionString)  
MessageBox.show(Isconnected) 

没发布项目的时候,一切正常。发布后在其他计算机上运行的时候,执行到  【isconnected= True】,就莫名其妙的退出了,没有提示错误
(【MessageBox.show(5)】这一步没有执行,MessageBox.show(4)】这一步执行了)就卡在isconnected上面


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