你代码不严谨而已吧,改为这样看看:
Dim xinxj As String = "Provider=SQLOLEDB;Password=1UmeLz2Qy4KX;Persist Security Info=True;User ID=OpenMas8020005;Initial Catalog=OpenMas;Data Source=111.1.2.106,1433\SQLEXPRESS"
If Forms("处理数据").Opened = False Then
If Connections.Contains("xinxj") = False
Connections.Add("xinxj",xinxj)
End If
If Connections.TryConnect(xinxj) = False Then ''''
Forms("数据源无法链接").open
Else '''
Dim cmd As New SQLCommand
Dim dt As DataTable
cmd.C
cmd.CommandText = "select top 1 * from Com_SmsIn_db8020005"
dt = cmd.ExecuteReader()
'''取接收表第一条内容
If dt.DataRows.Count =1 Then
Forms("处理数据").open
End If
End If
End If
实在不行,就:
http://www.foxtable.com/help/topics/2070.htm
[此贴子已经被作者于2014-4-10 14:43:19编辑过]