Re: CurrentDb in ADP

Tech-Archive recommends: Fix windows errors by optimizing your registry



Thanks Robert.

--
Brendan Reynolds


"Robert Morley" <rmorley@xxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:e3gyJkD0FHA.3812@xxxxxxxxxxxxxxxxxxxxxxx
> It applies pretty much anywhere that you use any connection in ADO (though
> I think they changed how it works in ADO.NET).
>
>
>
> Rob
>
> "Brendan Reynolds" <brenreyn@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
> news:uQAxdYC0FHA.3588@xxxxxxxxxxxxxxxxxxxxxxx
>> Thanks Robert,
>>
>> Do you happen to know, is this a general ADO issue or is it specific to
>> ADPs, e.g. does the same apply when using CurrentProject.Connection in an
>> MDB?
>>
>> --
>> Brendan Reynolds
>>
>> "Robert Morley" <rmorley@xxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
>> news:OM59JQC0FHA.3588@xxxxxxxxxxxxxxxxxxxxxxx
>>> Just a quick note: Brendan has fallen victim to one of the most common
>>> typos and/or little-known facts of ADO in terms of opening a recordset.
>>>
>>>> In an ADP using ADO ...
>>>>
>>>> rst.ActiveConnection = CurrentProject.Connection
>>>> rst.Source = "SELECT * FROM SomeTable"
>>>> rst.Open
>>>
>>> If you do it this way, ADO will open a separate connection object with
>>> the same properties as the current connection. In essence, it logs into
>>> SQL Server twice (or 10 times if you have 10 different recordsets, etc.)
>>>
>>> In order to use the same connection, you need to use the "Set" command
>>> when assigning the connection:
>>>
>>> Set rst.ActiveConnection = CurrentProject.Connection
>>> rst.Source = "SELECT * FROM SomeTable"
>>> rst.Open
>>>
>>> If I remember correctly, this isn't necessary if you're doing the
>>> one-liner style of opening a recordset, as the connection will properly
>>> be evaluated as a reference...but you might want to double-check on
>>> that.
>>>
>>> rst.Open "SELECT * FROM SomeTable", CurrentProject.Connection [, ...]
>>>
>>>
>>>
>>> Rob
>>>
>>
>>
>
>


.



Relevant Pages

  • Re: CurrentDb in ADP
    ... It applies pretty much anywhere that you use any connection in ADO (though I ... Rob ... > Brendan Reynolds ...
    (microsoft.public.access.adp.sqlserver)
  • Re: C++ support for ADO
    ... TESTHR(pConn.CreateInstance(__uuidof(Connection))); ... In answer to your question I'm interested in ADO not the ADO.net. ... data classes for working with ADO/OLE DB. ... You can also use the OLE SDK. ...
    (microsoft.public.data.ado)
  • Re: ODBC/OLE DB Connection Pool
    ... > connection be kept open for the application as this will serialize all ... threads ONCE they are returned to the pool. ... > Tips for ADO Users ... > The ADO Connection object implicitly uses IDataInitialize. ...
    (microsoft.public.inetserver.asp.db)
  • Re: ODBC/OLE DB Connection Pool
    ... > connection be kept open for the application as this will serialize all ... threads ONCE they are returned to the pool. ... > Tips for ADO Users ... > The ADO Connection object implicitly uses IDataInitialize. ...
    (microsoft.public.data.oledb)
  • Re: How to make the app run?????
    ... throwing an error if the connection never was opened, ... How can i tell if i'm using ADO as in VB or .Net ADO ?? ... First of all, it was not shown to my customer, I took it to a very nice ... How do you get in "installed" on client computer? ...
    (microsoft.public.dotnet.general)