I have a problem that ado returns an empty recordset
instead of raising a runtime error in the open method on
the recordset. Here's a VB6 code example:
Dim objC As New ADODB.Connection
Dim objRS As New ADODB.Recordset
objC.Open "Provider=MSDAORA.1;Data Source=bla;User
ID=bla;Password=bla"
objRS.Source = "select to_date
('2003/30/30:00:00:00','yyyy/mm/dd:hh24:mi:ss') from dual"
objRS.ActiveConnection = objC
objRS.Open
MsgBox objRS.EOF
MsgBox objRS.Fields(0).Value
The first message box confirms EOF = True. But when I try
objRS.Fields(0).Value I do not get an "Either BOF or EOF
is True, or the current record has been deleted. Requested
operation requires a current record." error, but I get the
actual runtime error which should have been raised in the
open method on the recordset: "ORA-01843: not a valid
month".
I have tried both the Microsoft OLEDB provider for Oracle
MSDAORA.1 and the Oracle OLEDB provider for Oracle
OraOLEDB.Oracle. I have tried ado 2.5 and ado 2.7. I have
also tried a VBScript version of the code running in the
Windows Scripting Host and an IIS ASP page. All show the
same strange behaviour which points to ADO.
Last week I saw the same strange behaviour in another
database where ADO would not raise an "ORA-01652: unable
to extend temp segment by 128 in tablespace TEMP" error in
the open method on the recordset, but simply returned an
empty recordset. I only found out what the error was by
running the same query in SQLPLUS and TOAD, which do not
use ADO.
Has anybody seen this strange behaviour and is there a fix?
Kind regards,
Remco
--
Víctor Koch From Argentina.
"Remco Blok" <remco...@logicacmg.com> escribió en el mensaje
news:0a5201c3a2cd$bce426d0$a601...@phx.gbl...
Remco
>.
>
Kind Regards,
Remco
Kind regards,
Remco
>.
>
is 2003/30/30 a typo ??? if not the date format is
incorrect... months should be between 1-12
>.
>
Kind Regards,
Remco
This is not good. Go and have a look at Microsofts documentation on what it
means if you fail to provide RecordSet Open() with rest of the parameters.
If you fail to provide the arguments, particularly the 5th argument, ADO has
to deduce what Source is. A slight performance loss.
I mean it could be Stored Procedure, SQL command, Table, what? Who knows
what ADO thinks Source is? It is conceivable that ADO might guess wrongly.
Open() is the most important call of a Recordset. Depending on what the
arguments are, it completely controls how various properties behave.
Therefore make sure you specify all arguments and leave nothing to chance so
you get exactly the type of recordset you want. Don't ask for more
functionality than you need. If you don't plan to update your Recordset,
specify a read-only cursor.
Did you want a client-sided or server-side cursor location?
Did you want a read-only locktype?
Did you want a forward only cursor (the fastest cursor but very limited
functionality: RecordCount will be -1)?
I would try client-sided,static cursor,readonly with adCmdText as the hint
and see what you get.
Hope this helps
Stephen Howe
Unfortunately specifying a client-side static cursor, read
only and adCmdText with the recordset open method did not
make a difference. I'll try re-installing mdac
Regards,
Remco
>.
>
Dim objC
Dim objRS
Dim sDescription, sSource, iNumber
Dim vDummy
Set objC = CreateObject("ADODB.Connection")
Set objRS = CreateObject("ADODB.Recordset")
objC.Open "Provider=MSDAORA.1;Data Source=bla;User
ID=bla;Password=bla"
objRS.Source = "select to_date
('2003/30/30:00:00:00','yyyy/mm/dd:hh24:mi:ss') from dual"
objRS.ActiveConnection = objC
On Error Resume Next
objRS.Open
iNumber = Err.Number
sSource = Err.Source
sDescription = Err.Description
On Error GoTo 0
If iNumber<>0 Then
Err.Raise iNumber,sSource,sDescription
End If
On Error Resume Next
vDummy = objRS.Fields(0).Value
iNumber = Err.Number
sSource = Err.Source
sDescription = Err.Description
On Error GoTo 0
If iNumber <> 0 And iNumber <> adErrNoCurrentRecord Then
Err.Raise iNumber,sSource,sDescription
End If
Jerry
"Remco Blok" <remco...@logicacmg.com> wrote in message
news:0a5201c3a2cd$bce426d0$a601...@phx.gbl...