发表于:2005-06-03 11:44:00
楼主
在需要多情况下,ifix本身的脚本编写,会出现很多不便,本文以如何调用ifix过程数据库的标签名列,介绍如下:下面是详细源代码:
'*******************************************************************************Public Class dyIFIX
Inherits System.Windows.Forms.ComboBox
#Region " Windows 窗体设计器生成的代码 "
Public Sub New()
MyBase.New()
'该调用是 Windows 窗体设计器所必需的。
InitializeComponent()
'在 InitializeComponent() 调用之后添加任何初始化
End Sub
'UserControl1 重写 dispose 以清理组件列表。
Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)
If disposing Then
If Not (components Is Nothing) Then
components.Dispose()
End If
End If
MyBase.Dispose(disposing)
End Sub
'Windows 窗体设计器所必需的
Private components As System.ComponentModel.IContainer
'注意: 以下过程是 Windows 窗体设计器所必需的
'可以使用 Windows 窗体设计器修改此过程。
'不要使用代码编辑器修改它。
<System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
'
'dyIFIX
'
Me.Name = "UserControl1"
Me.Size = New System.Drawing.Size(248, 32)
End Sub
#End Region
'内部变量
Public I_fixs As String = "Fix"
Public I_type As String = "DO"
Public Property ifixs() As String
Get
Return I_fixs
End Get
Set(ByVal Value As String)
I_fixs = Value
End Set
End Property
Public Property type() As String
Get
Return I_type
End Get
Set(ByVal Value As String)
I_type = Value
End Set
End Property
Public Sub Init_Combobox(ByVal Com As ComboBox)
Dim connRealDB As ADODB.Connection
Dim rsRealDB As ADODB.Recordset
Dim rsCount As Short
Try
connRealDB = New ADODB.Connection
rsRealDB = New ADODB.Recordset
connRealDB.Open("Provider=MSDASQL.1;Persist Security Info=False;User ID=sa;Data Source=FIX Dynamics Real Time Data")
'*****************************************************************************
Dim sqlStr As String
sqlStr = "Select A_TAG from " & I_fixs & " where A_NAME='" & I_type & "'"
'*****************************************************************************
rsRealDB.Open(sqlStr, connRealDB)
Com.Items.Clear()
While rsRealDB.EOF <> True
Com.Items.Add(rsRealDB.Fields("A_TAG").Value)
rsRealDB.MoveNext()
End While
Catch ex As Exception
MsgBox(ex.ToString)
Finally
If rsRealDB.State = True Then
rsRealDB.Close()
End If
connRealDB.Close()
End Try
End Sub
End Class
'******************************************************************************