Dim lx As WinForm.ComboBox = e.Form.Controls("ComboBox1") '数据库类型
Dim k As WinForm.ComboBox = e.Form.Controls("ComboBox2") '数据库
RibbonTabs("ljsj").Groups("功能组_logo").Items("文本框_数据年度").text = e.Form.Controls("ComboBox2").value
Dim value1,name1 As String
If lx.Value = "Access 2000/2003" Then
If k.value = "默认" Then
name1 = "data.mdb"
Else
name1 = "data" & val(k.value) & ".mdb"
End If
If FileSys.FileExists(ProjectPath & name1) Then
For Each frm As WinForm.Form In forms '关闭主窗口以外的所有窗口,确保没有其他窗口打开
If frm.Name <> "主窗口" And frm.Opened Then
frm.close()
End If
Next
value1 = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & ProjectPath & name1 & ";Persist Security Info=False"
SaveConfigValue("数据源",value1)
SaveConfigValue("数据源文件名",name1)
Dim s As String =""
'遍历当前属于此数据源的表
For Each dt As DataTable In DataTables
If dt.C Then
s += "|" & dt.name
End If
Next
s = s.Trim("|")
'卸载表
DataTables.Unload(s)
If Connections.Contains("data") Then
Connections.Delete("data")
End If
Connections.add("data",value1)
DataTables.load(s)
e.Form.Close()
'Forms("数据分析").open()
'MainTable = Tables("院校信息")
''Syscmd.Project.Open(FileName)
' Application.Restart() '系统重新启动
Else
MessageBox.Show("没有该年度数据,请与开发者联系!","提示",MessageBoxButtons.OK,MessageBoxIcon.Information)
End If
Else If lx.Value = "Access 2007/2010" Then
'name1 = ProjectPath & "data" & val(k.value) & ".accdb"
'If FileSys.FileExists(name1) Then
'value1 = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" & ProjectPath & "data" & val(k.value) & ".accdb;Persist Security Info=True"
'SaveConfigValue("数据源",value1)
''Syscmd.Project.Open(FileName)
'Application.Restart() '系统重新启动
'Else
'MessageBox.Show("没有该年度数据,请与开发者联系!","提示",MessageBoxButtons.OK,MessageBoxIcon.Information)
'End If
End If
Forms("主窗口").open()
MainTable = Tables("sys")