请高手帮请帮忙看我是在做一个报表程序
Private Sub CmdSearch_Click()
Dim dtmMomth As String
Dim StartDate As String
StartDate = Format(Format(Me.dtpStart, "yyyy-mm") & "-01 00:00:00", "yyyy-mm-dd HH:mm:ss")
dtmMONTH = DateAdd("m", 1, Format(Me.dtpStart, "yyyy-mm") & "-01")
‘必须先引用ADO控件定义
‘查询语句
Dim Sql As String
Dim cnADO As ADODB.Connection
Dim rsADO As Recordset
‘查询设置
Sql = "SElECT VALUE,DATETIME,TAG" & _
"FROM FIX" & _
"WHERE (DATETIME>={ts‘" & StartDate & "‘} AND " & _
"DATETIME <={ts‘" & dtmMomth & "‘})" & _
" AND INTERVAL = ‘00:01:00‘"
" AND INTERVAL = ‘00:01:00‘"
‘连接并读取数据库
Set cnADO = New ADODB.Connection
Set rsADO = New ADODB.Recordset
‘连接数据设置指向所需要连接的位置,此处连接到IFX的历史数据库.
cnADO.ConnectionString = "Provider = Microsoft OLE DB Provider " & _
"for ODBC Drivers;DSN=FIX Dynamics Historical Data;UID =;PWD =;"
‘打开连接
cnADO.Open
‘把数据放到客户端来
rsADO.CursorLocation = adUseClient
‘查询数据,根据SQL定义的查询设,选择CnADO所连接的通道.将数据放到rsADO 记录集里
rsADO.Open Sql, cnADO, adOpenDynamic, adLockUnspecified, -1
If rsADO.RecordCount <= 0 Then
MsgBox "该时间范围无数据!"
Exit Sub
End If
只要一运行以上程序不知何故老是出现以下提示,
运行时错误‘2147217900‘"【FIX-Historical Data Access-ODBC Dricer】Expected lexical element not found:FROM
不知道如何解决此问题请高手指点指点
ifix报表完美解决方案:DreamReport首家工业自动化行业的报表软件。欲了解详细信息请回Msn: drchinasupport@hotmail.com