
ADO: Access97 Stored Procedures not supported with OLE DB Jet provider?
Hi.
Se comments inline...
Nils
Quote:
> Here is the code I actually used to achieve the same thing:
> Public Sub getAgeBand(ByVal iAgeGroup As Integer, ageMin As Integer,
agemax As Integer)
> Dim c As New adodb.Command
> Dim r As adodb.Recordset
> Set c.ActiveConnection = m_connection
> c.CommandType = adCmdTable
> c.CommandText = "qcGetAgeRange"
> c.Parameters(0).Value = iAgeGroup
> c.Parameters(0).Size = 2
> Set r = c.Execute
Just be aware that .Execute always returns a readonly recordset.
Quote:
> If Not r Is Nothing Then
Sometimes an ADO-error occurs without triggering a VB-error.
You might get a closed rs in return, the test over would fail, and
the next lines would trigger an error...
Quote:
> ageMin = r.Fields(0).Value
> agemax = r.Fields(1).Value
> End If
> Set c.ActiveConnection = Nothing
> Set c = Nothing
> If Not r Is Nothing Then
> If r.State = adodb.adStateOpen Then
.State is a flag, so it might not be equal to adStateOpen
(That is, it is adStateOpen ORed with some other value)
You should test it like this:
If (r.State AND adStateOpen) = adStateOpen Then
(I know I didn't code this right in my last code-example...)
Quote:
> Set r = Nothing
I think you should use .Close first. Memory leaks is not fun...
Quote:
> End If
> End If
> End Sub
> I was wondering, say I have 5 queries to execute one after the other,
shall
> I recreate each time a new Command object and a new Recordset object?
> Is there some performance improvement in doing so.
Are you using MTS? Is it the same queries with different parameters?
Do the queries have to run in a predefined order? Personly I'd close the
recordset and set it to nothing each time, but only change the
parameters
of the command object, if it's the same command you want to execute.
Quote:
> I know it's cleaner not to do so but I need to gain any msec of
execution.
> Thanks a lot,
> Yann.
If you depend om milliseconds, and you only use Access, it seems from
what
I have read here, and in MSDN, that DAO is still the choice. It's
tailored to Jet,
while ADO has to work for many different providers. Of course things
change
fast, and I have not tested this myself.
Nils