Re: ado connection object in vb6




"wb" <none> wrote in message news:uclYg7opIHA.2636@xxxxxxxxxxxxxxxxxxxxxxx
Ok, now I am confused. One person recommends local objects, you recommend
global objects.....

The basic model that I have used inside the dll is that when I need to
access the database I create a string variable and write the SQL. Then I
use a local adodb.recordset object (lets call it objRS) and I code a line
objRS.Open ("SQL string", global ado.connection).

I populate the record data into the object I am dealing with, say a
customer, and then I close the recordset and set it to nothing

WB



While the information on connection objects and connection pooling is useful
it doesn't answer your specific question. So let me revisit it ...

In this context ...
Main Executable
Creates a ADODB.Connection
Uses a Dll
Which creates an ADODB.Connection object
Should NOT have much effect on performance, especially if you are using the
same Connection general parameters. (Data Source, authentication,
Properties, etc.)

Your performance issues are likely due to something else.

This is the normal architecture for your average client/server application:

' So global spot
Public WithEvents adoCnn As ADODB.Connection
'
' Some init, load, main etc...
On Error Goto ...
' create the object
Set adoCnn = New ADODB.Connection
' open it creating your first authenticated connection
' test to make sure it valid etc.
adoCnn.Open( .... )
' note: Close doesn't really do all that much, it just releases the
connection
' back to the pool
adoCnn.Close
....
Elsewhere in your application where you go to use it...

Private Sub Command1_Click()
' setup any different cursors, locks you want etc.
adoCnn.PropertyX = adSomething
adoCnn.Open()
' or
adoCnn.Open( , adSomething, etc)
'or if using the same, just open it
adoCnn.Open

'Use the connection
dim rs as adodb.recordset:
Set rs = adoCnn.Execute()
...
rs.close: set rs = nothing
' When done close it
adoCnn.Close()
End Sub

Redo your application along these lines. This will remove any "Connection
Issues" you might be having. Then isolate those areas where you are
experiences performance issues and post back. People here can help with
those specific situation.

-ralph







.



Relevant Pages

  • RE: svchost.exe Application Error.
    ... Description: Net Win32 API DLL ... P.S the NetBio over TCP/IP is on the Internet Protocol TCP/IP properties, ... you gone to the Network connection and Right click your Wireless/Wired LAN, ...
    (microsoft.public.windowsxp.network_web)
  • RE: svchost.exe Application Error.
    ... Description: Net Win32 API DLL ... P.S the NetBio over TCP/IP is on the Internet Protocol TCP/IP properties, ... you gone to the Network connection and Right click your Wireless/Wired LAN, ...
    (microsoft.public.windowsxp.network_web)
  • RE: svchost.exe Application Error.
    ... Description: Net Win32 API DLL ... P.S the NetBio over TCP/IP is on the Internet Protocol TCP/IP properties, ... you gone to the Network connection and Right click your Wireless/Wired LAN, ...
    (microsoft.public.windowsxp.network_web)
  • Re: Getting Calling Thread (DLL) Module Name
    ... > called the server). ... connection information for all context for various ideas; ... the name of the DLL, We just know the program name. ... In the above snapshot, where there is an HTTP connection type, we know its ...
    (microsoft.public.win32.programmer.kernel)
  • Re: Where to place app.config file
    ... If you create the app.config for project1 your DLL will just read that APP ... So there would be no need to pass the connection string from the EXE ... from a different config, you may try searching groups.google.com if you ... > public static SqlConnection Connection() ...
    (microsoft.public.dotnet.languages.csharp)

Loading