ifix从sqlserver里读数据_IFIX读取SQL数据库
PrivateSubcmdreport_Click()IfMe.TextBox1.Text=""ThenMsgBox"请输入批号"ExitSubEndIf'-------------------------------------------------------------------------------------------------------DimblShow...
Private Sub cmdreport_Click()
If Me.TextBox1.Text = "" Then
MsgBox "
请输入批号
"
Exit Sub
End If
'-------------------------------------------------------------------------------------------------------
Dim blShow As Boolean
' Dim conODBC As ADODB.Connection
'Dim adoRS As ADODB.Recordset
'Set conODBC = New ADODB.Connection
' Set adoRS = New ADODB.Recordset
' Dim strQuery As String
' conODBC.ConnectionString = "Provider = Microsoft OLE DB Provider for ODBC Drivers;" & _
'
"DSN=shxy1;UID=sa;PWD=sa;"
' conODBC.Open "shxy1", "sa", "sa"
'
以下是按批次查询
'strQuery
=
"select
*
from
shxy1_batch
where
cpph='"
+
Me.TextBox1.Text
+
"'
order
by
shxy1_batch.th ASC"
'
分装
%%%%%%%%%%%%%%%
'
以下是按时间查询
'strQuery = "SELECT * from znyt02" & _
'
" WHERE DA
TETIME>=#" & d_start & "# AND" & _
'
" DA
TETIME<= #" & d_end & "#"
'---------------------------------------------------------------------------------------------------------------------
Dim conODBC As ADODB.Connection
Dim adoRS As ADODB.Recordset
Dim strQuery As String
strQuery = "select * from Batch where PH='" + Me.TextBox1.Text + "' order by Batch.TH
ASC"
Set conODBC = New ADODB.Connection
conODBC.ConnectionString = "DSN = IFIXSQL; UID =sa; PWD =sa;"
Set adoRS = New ADODB.Recordset
conODBC.Open "IFIXSQL", "sa", "sa"
'
adoRS.Open strQuery, conODBC, adOpenDynamic, adLockPessimistic
'-------------------------------------------------------------------------------------------------
更多推荐




所有评论(0)