Help, any ideas??
I am using the OLEDB adapter (Oracle OLEDB) with Oracle 10.2.0.3.0. My code generates the SQL for the query, then when I execute it into an OLEDBDataReader, the HasRows is False. However, if I output the contents of the query string, copy, and paste into SQL+ (logged in as the same user from the same client machine), it returns 993 rows. What gives??
Here’s a segment of my code:
Dim DB As New OleDb.OleDbConnection(String.Format("{0};Password={1}", ConnectionString, DBPassword))
Dim flowQuerySQL As String
'... code to generate query
Debug.Print(flowQuerySQL)
Dim flowQueryCMD As New OleDb.OleDbCommand(flowQuerySQL, DB)
Dim flowQuery As OleDb.OleDbDataReader = flowQueryCMD.ExecuteReader()
While flowQuery.HasRows
'...handle rows
End While
The debug.print statement shows:
SELECT CLASS_ID, OBJECT_ID FROM TDM_SF_PROCESS WHERE CLASS_ID=853 AND TDM_END_TIME >= '01-Jan-2009' AND TDM_END_TIME < '31-May-2009' AND TDM_STATUS <> 1 AND TDM_STATUS <> 2
I have just recently started working VB.NET against Oracle, and dates are tempermental.
This approach has worked for me so far:
It wouldn’t work until I used the “TO_DATE” function. Hopefully this will work for you, too.
I’m a MS-SQL guy, so I haven’t been able to research the “why” of why this works, yet. Enlightenment, anyone?