-- 作者:jacksn
-- 发布时间:2013/11/9 11:34:00
--
这个是项目事件代码,请看是否有何问题(用户有一个“数据源”属性)
BeforeConnectOuterDataSource
\'\'\'选择数据源
Dim ds As String =
e.Name \'data source
Dim cs As String =
"Provider=SQLOLEDB.1;Password=****;Persist Security Info=True;User
ID=foxtable"
Dim ex As String =
e.User.ExtendedValues("数据源")
Select Case ex
Case "局域网"
e.ConnectionString = cs &
";Data Source=rhl-server"
Case
"互联网"
e.ConnectionString = cs &
";Data Source=rhlgzedg.vicp.cc"
Case "本地" e.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source = J:\\Tools\\FoxTable\\项目1_天平行数据库系统\\Attachments\\备用外数据源2.mdb;Persist Security Info=False"
Case "手动"
e.EditConnectionString()
Case "自动"
If
Network.Ping("192.168.1.16") = True
Then \'如果局域网接通
e.ConnectionString = cs &
";Data Source=rhl-server"
ElseIf
Network.Ping("rhlgz.vicp.cc") = True
Then \'采用互联网数据库
e.ConnectionString = cs & ";Data Source=rhlgzdeg.vicp.cc"
Else \'如果互联网无法接通,采用本地数据库
e.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source = J:\\Tools\\FoxTable\\项目1_天平行数据库系统\\Attachments\\备用外数据源2.mdb;Persist
Security Info=False"
End If
End Select
[此贴子已经被作者于2013-11-10 20:24:57编辑过]
|