Re: ado connection object in vb6
- From: "wb" <none>
- Date: Mon, 28 Apr 2008 07:56:42 -0700
Wow, thank you for taking the time and giving detailed explanations. That
helps me. Your architecture is exactly how I have designed my application.
Up until the latest release where I added the connection within the exe,
there weren't many issues. Since users have been complaining and I have
verified slowdowns, it seemed like the best place to start was looking at
whether or not two ado connections objects would be the cause.
You seem to think two objects shouldn't matter, so there must be something
else. Needle meet haystack....
WB
"Ralph" <nt_consulting64@xxxxxxxxx> wrote in message
news:OUydgYupIHA.3804@xxxxxxxxxxxxxxxxxxxxxxx
"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
.
- References:
- ado connection object in vb6
- From: wb
- Re: ado connection object in vb6
- From: Ralph
- Re: ado connection object in vb6
- From: wb
- Re: ado connection object in vb6
- From: Ralph
- ado connection object in vb6
- Prev by Date: Re: ado connection object in vb6
- Next by Date: Visual Basic 6.0 problem!
- Previous by thread: Re: ado connection object in vb6
- Next by thread: Re: ado connection object in vb6
- Index(es):
Relevant Pages
|
Loading