请教Oracle的OLEDB驱动问题
以下是我用VBA编写的代码:'ADO连接对象定义
Global OraConn As ADODB.Connection
Global OraRs As ADODB.Recordset
Public Const Con_TP As String = "rovider=OraOLEDB.Oracle.1ersist Security Info=true;User ID=****assword=****;Data Source=****"
Set OraConn = New ADODB.Connection
'数据库链接语句
OraConn.ConnectionString = Con_TP
OraConn.Open
strSQL = "Select * From TBL_GSDL_WatchOnDuty where WatchDate = '" & DTReport & "' and WatchShift = '夜班'"
OraRs.Open strSQL, OraConn
结果是OraRs.EOF = True(实际上有相应的查询结果集且只有唯一一条记录)
现在我做如下尝试:
一、Con_TP不变,strSQL重新赋值。strSQL = "Select * From TBL_GSDL_WatchOnDuty where WatchDate = '" & DTReport & "'"
结果是OraRs.EOF = False(查询结果集有多条记录)
二、strSQL不变。Con_TP重新赋值。Public Const Con_TP As String = "rovider=MSDAORA.1ersist Security Info=True;Data Source=****;User Id=****assword=****"
结果是OraRs.EOF = False(查询结果集只有唯一一条记录)
我的问题是产生这种结果的原因是什么?我想通过RecordSet的EOF属性来判断是否有结果集。但是当有一条记录的时候却无法用来判断。请问这是什么原因?