View Single Post
Mentor
6Sep2008,15:49  
xpi0t0s's Avatar
This will be because you're running the query twice. Enable SQL*Net tracing, then step through the code in the debugger and watch the trace file in an editor (you may need to reopen the trace file each step to see what's new, depending on which editor you use). Then you will be able to see where the extra run occurs.

I checked with Oracle 10.2.0.3, using OLE DB 10.2.0.2.20 and the following code:

Code:
       Dim oCon As ADODB.Connection
       Text = "Provider=ORAOLEDB.ORACLE;Data Source=V102_host;User ID=scott;Password=tiger"
       oCon = New ADODB.Connection
       oCon.ConnectionString = Text
       oCon.Open()

       Dim oCmd As ADODB.Command
       oCmd = New ADODB.Command
       oCmd.ActiveConnection = oCon
       oCmd.CommandType = ADODB.CommandTypeEnum.adCmdText
       oCmd.CommandText = "select hqproj.nextval from dual"
       'oCmd.Execute()

       Dim oRst As ADODB.Recordset
       oRst = New ADODB.Recordset
       oRst.Open(oCmd)
       Do While Not oRst.EOF
           MsgBox("<" & oRst(0).Value & ">")
           oRst.MoveNext()
       Loop
With oCmd.Execute() not commented out I also got the same behaviour, because oRst.Open also executes the query.