发表于:2003-12-17 13:51:00
6楼
此用ODBC定义连接,用ADO自己参考下列语句
Dim WithEvents rsADO As ADODB.Recordset
Dim WithEvents cnADO As ADODB.Connectio
定义ODBC的连接
Set cnADO = New ADODB.Connection
Set rsADO = New ADODB.Recordset
str_con = "PROVIDER=MSDASQL;dsn=chuli;uid=;pwd=;"
cnADO.Open str_con
cnADO.CursorLocation = adUseClient
str_rs_star = CStr(CDate(TxtDate.Text)) & " 00:00:01"
str_rs_stop = CStr(DateAdd("d", 1, CDate(TxtDate.Text)))
& " 00:30:00"
str_rs = "select * from data1 where dt_tm >= #" &
str_rs_star & "# and dt_tm <= #" &
str_rs_stop & "# order by dt_tm"
rsADO.Open str_rs, cnADO, adOpenKeyset, adLockOptimistic
rsADO.Requery