ADO: Access97 Stored Procedures not supported with OLE DB Jet provider? 
Author Message
 ADO: Access97 Stored Procedures not supported with OLE DB Jet provider?

From MS site:

"Command text in the Command object uses the Jet SQL dialect. You can
specify row-returning queries, action queries, and table names in the
command text; however, stored procedures are not supported and should
not be specified."

Does it mean that I can't call the following Access97 query:

PARAMETERS aParam TEXT;
SELECT [aColumn] FROM [aTable] WHERE [aValue]=[aParam];

Thanks for your help.

Yann.



Sat, 08 Dec 2001 03:00:00 GMT  
 ADO: Access97 Stored Procedures not supported with OLE DB Jet provider?
Well, found it.
It can be done using the CommandType adCmdTable as opposed to
adCmdStoredProc.

Yann.



Sat, 08 Dec 2001 03:00:00 GMT  
 ADO: Access97 Stored Procedures not supported with OLE DB Jet provider?


Fri, 19 Jun 1992 00:00:00 GMT  
 ADO: Access97 Stored Procedures not supported with OLE DB Jet provider?
Yes you can.

What Jet supports, and you want to use, is a "stored query".
The "stored procedure" they talk about is code and/or one or more
SQL queries, compiled in the database and given a name. Access97
has no such thing, as far as I know.

Here is how I get an updatable, disconnected recordset using a
stored query with an in-parameter:

  Dim objConn As ADODB.Connection
  Dim objCommand As ADODB.Command
  Dim objRecSet As ADODB.Recordset

  Set objConn = New ADODB.Connection
  Set objCommand = New ADODB.Command
  Set objRecSet = New ADODB.Recordset

  objConn.CursorLocation = adUseClient
  objCommand.CommandText = strQueryName

  ' lngValue is the in-parameter value in this example
  objCommand.Parameters.Append objCommand.CreateParameter("aParam",
adInteger, adParamInput, ,lngValue)

  objConn.Open strConnectString
  objCommand.ActiveConnection = objConn
  objRecSet.Open objCommand, , adOpenStatic, adLockBatchOptimistic,
adCmdTable
  'Note: Important to use adCmdTable, not adCmdStoredProc

  Set objCommand.ActiveConnection = Nothing
  Set objRecSet.ActiveCommand = Nothing
  Set objRecSet.ActiveConnection = Nothing
  Set objCommand = Nothing
  If (objConn.State And adStateOpen) Then objConn.Close
  Set objConn = Nothing

Nils

Quote:

> From MS site:
> "Command text in the Command object uses the Jet SQL dialect. You can
> specify row-returning queries, action queries, and table names in the
> command text; however, stored procedures are not supported and should
> not be specified."
> Does it mean that I can't call the following Access97 query:
> PARAMETERS aParam TEXT;
> SELECT [aColumn] FROM [aTable] WHERE [aValue]=[aParam];
> Thanks for your help.
> Yann.



Sat, 08 Dec 2001 03:00:00 GMT  
 ADO: Access97 Stored Procedures not supported with OLE DB Jet provider?
Thanks Nils,

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

    If Not r Is Nothing Then
        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
            Set r = Nothing
        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.

I know it's cleaner not to do so but I need to gain any msec of execution.

Thanks a lot,

Yann.



Sun, 09 Dec 2001 03:00:00 GMT  
 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



Sun, 09 Dec 2001 03:00:00 GMT  
 ADO: Access97 Stored Procedures not supported with OLE DB Jet provider?
PMFJI.  I am pretty new with this stuff and was wondering if your comment is
provider-dependent.  I have code that uses cmd.Execute, and I can add,
change, delete records in the returned recordset.



Quote:
> >     Set r = c.Execute

> Just be aware that .Execute always returns a readonly recordset.



Sun, 09 Dec 2001 03:00:00 GMT  
 ADO: Access97 Stored Procedures not supported with OLE DB Jet provider?

Quote:

> 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

Nils,

Thank you immensively for your help.
I wanted to use ADO because one may need to sitch to SQL Server in the near
future.
Also, how do you achieve connection pooling using DAO and Access?

Regards,

Yann.



Sun, 09 Dec 2001 03:00:00 GMT  
 ADO: Access97 Stored Procedures not supported with OLE DB Jet provider?
Sorry,

but you'd better ask someone in the DAO groups.
I know even less about DAO than I know about ADO...

Nils

Quote:


> > 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
> Also, how do you achieve connection pooling using DAO and Access?
> Regards,
> Yann.



Mon, 10 Dec 2001 03:00:00 GMT  
 ADO: Access97 Stored Procedures not supported with OLE DB Jet provider?
Interesting!

As I said, things change fast with ADO... The fact that the ADO
(2.1) helpfile makes a point out of telling that Connection.Execute
will return a readonly recordset, while saying nothing about what
recordset the Command.Execute returns, is suggestive...

All I can say is that using ADO 2.0 (Microsoft.Jet.OLEDB.3.51)
against an Access97 database, the only way we could get hold
of an updatable recordset using parameters was to use the
command-object in the rs.Open-command. The documentation at
that time seemed to support this view.

Anyone following this thread that knows more?

Nils

Quote:

> PMFJI.  I am pretty new with this stuff and was wondering if your
comment is
> provider-dependent.  I have code that uses cmd.Execute, and I can add,
> change, delete records in the returned recordset.


> > >     Set r = c.Execute
> > Just be aware that .Execute always returns a readonly recordset.



Mon, 10 Dec 2001 03:00:00 GMT  
 
 [ 10 post ] 

 Relevant Pages 

1. ADO: Access97 Stored Procedures not supported with OLE DB Jet provider?

2. Retrieving OLE DB provider datatype support using ADO

3. Create Jet 3.5x DB with OLE DB Provider 4.0

4. Stored procedures, ADO, OLE DB

5. Data Environment/Jet 4.0 OLE DB Provider problem

6. OLE DB Provider for Jet 3.5x

7. Microsoft.Jet.OLEDB.4.0 OLE DB provider

8. Connection with OLE DB Jet 3.51 Provider

9. OLE DB Provider 4.0 for Jet SLOW

10. OLE DB Jet Provider 3.51 or 4.0 ?

11. Microsoft Jet 3.51 Ole Db Provider, where is?

 

 
Powered by phpBB® Forum Software