发表于:2002-10-23 20:43:00
6楼
打开网络及其子系统。
部分程序源代码如下:
设置多用户共享数据库方式
ObjectServerForm.LcaObjectServer1.SingleUserMode = False
打开对象服务器
ObjectServerForm.LcaObjectServer1.Open
增加网络接口名到接口列表框中
Set NetworkInterfaceCollection = ObjectServerForm.LcaObjectServer1.NetworkInterfaces
count = NetworkInterfaceCollection.count
For i = 1 To count
Set CurrentNetworkInterface = NetworkInterfaceCollection(i)
If CurrentNetworkInterface = "PCCLON1" Then
InterfaceName.AddItem CurrentNetworkInterface
End If
Next i
添加数据库名到到网络数据库列表框中
Set NetworkCollection = ObjectServerForm.LcaObjectServer1.Networks
count = NetworkCollection.count
For i = 1 To count
Set CurrentNetwork = NetworkCollection(i)
If CurrentNetwork = "zhuo" Then
DBName.AddItem CurrentNetwork
End If
Next I
打开系统
Set CurrentSystem = CurrentNetwork.Systems(1)
CurrentSystem.Open
打开网络
Set CurrentNetwork = NetworkCollection(NetName)
CurrentNetwork.Open
4、将数据库中的卡号自动发到黑名单节点功能的实现
根据黑名单节点卡号的定义的数据结构,通过循环语句须将数据库每一条记录中的卡号段加上一个记录的记录数一起发送给黑名单节点的输入网络变量。黑名单节点输出网络变量(注销无效卡号)会根据节点程序自动更新。
如数据库中的第3个记录的卡号为20 00 07 11时,输入网络变量实际应为2 20 00 07 11。
部分程序源代码如下:
Private Sub Command3_Click()
Dim nv As LcaNetworkVariable
Dim ind As Integer
Dim i As Integer
If Data1.Recordset.BOF And Data1.Recordset.EOF Then Exit Sub
Data1.Recordset.MoveLast
ind = Data1.Recordset.RecordCount
Set CurrentAppDevice = AppDevicesCollection("blacknode")
获得所有网络变量
Set CurrentInterface = CurrentAppDevice.Interface
Set NVsCollection = CurrentInterface.NetworkVariables
Data1.Recordset.MoveFirst
发送卡号给相应的网络变量
For i = 1 To ind Step 1
NVsCollection(1).Value = Str(i - 1) + " " + Data1.Recordset.Fields("卡号")
Data1.Recordset.MoveNext
If Data1.Recordset.EOF Then Exit Sub
Next i
End Sub
5、黑名单节点软件初始化功能的实现
将黑名单节点50个输出网络变量(注销无效卡号)强制设定为88 88 88 88 或任意其它不可能的卡号。
Set CurrentAppDevice = AppDevicesCollection("blacknode")
Set CurrentInterface = CurrentAppDevice.Interface
Set NVsCollection = CurrentInterface.NetworkVariables
Dim j As Integer
For j = 1 To 50
NVsCollection(1).Value = Str(j - 1) + " " + "88" + " " + "88" + " " + "88" + " " + "88"
Next j
6、从黑名单节点中读取黑名单卡号功能的实现
注销无效卡号的数据显示必须把50个网络变量中非黑名单卡号过滤掉,并相应计算出当前黑名单人数。
Dim nv As LcaNetworkVariable
Dim index As Integer
Dim i, j As Integer
Dim jl As Node
Screen.MousePointer = 11
TreeView1.Nodes.Clear
确定当前应用节点为黑名单节点
Set CurrentAppDevice = AppDevicesCollection("blacknode")
Set CurrentInterface = CurrentAppDevice.Interface
Set NVsCollection = CurrentInterface.NetworkVariables
index = NVsCollection.count
For i = 2 To index
Set nv = NVsCollection(i)
If (Mid(nv.Value, 1, 2) + Mid(nv.Value, 4, 2) + Mid(nv.Value, 7, 2) + Mid(nv.Value, 10,
2)) = "88888888" Then
j = j + 1
Else
Set jl = TreeView1.Nodes.Add(, , , "cardno", 1)
jl.Text = nv.Value
jl.Tag = nv
End If
Next i
Text1.Text = "黑名单人数:" + Str(50 - j) + "人"
Screen.MousePointer = 0
End Sub