If e.Name = "ddd" Then If Connections.TryConnect(e.ConnectionString) = False Then Dim strConn As String = "" Dim flag As Boolean = False If FileSys.FileExists(e.ProjectPath & "ip.txt") Then strConn = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & FileSys.ReadAllText(e.ProjectPath & "ip.txt",Encoding.Default) & ";Persist Security Info=False" If Connections.TryConnect(strConn) = False Then flag = False Else e.ConnectionString = strConn flag = True End If End If If flag = False Then Dim dlg As New OpenFileDialog dlg.Filter= "Access文件|*.mdb" If dlg.ShowDialog = DialogResult.Ok Then e.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & dlg.FileName & ";Persist Security Info=False" FileSys.WriteAllText(e.ProjectPath & "ip.txt", dlg.FileName, False, Encoding.Default) End If End If End If End If
|