Solved

ADO Connection

Posted on 2000-02-22
3
148 Views
Last Modified: 2013-11-23
I have an class that utilizes a ADO Connection object.  This object gets set after i create the object.  When I call a function in the class(piece of it below) I get an error(3001) if using the first line..and w/ the second it works..but the recordset it returns is forward and read-only which just wont cut it.


Dim rsTemp As ADODB.Recordset
    Set rsTemp = New ADODB.Recordset

---Give 3001 error.
    rsTemp.Open "select * from " & strProject & "_settings where messaging = 1", conMain, adOpenStatic, adLockOptimistic

---Works fine but recordset is limited
Set rsTemp = conMain.Execute("select * from " & strProject & "_settings where messaging = 1")


I have looked for previous questions here however there are only a few w/o 'specific' answers, and MSDN Library has a single reference to this error however it only talks about Command objects.

TechInfo- VB6EE w/ SP3 w/ the latest MDAC


Spri
0
Comment
Question by:Spri
3 Comments
 
LVL 9

Accepted Solution

by:
Ruchi earned 50 total points
ID: 2548399
try this one...

with conMain
  .provider = .....
  .connectstring = "your file"
  .open
end with

rsTemp.Open "select * from " & strProject & "_settings where messaging = 1", conMain, adOpenStatic, adLockOptimistic
0
 

Author Comment

by:Spri
ID: 2548443
I changed the setup of the code to accomodate this problem..instead of setting the connection i am passing it the connection string and creating the connection and openning it in the class.


Thanks for the effort.

Spri
0
 

Expert Comment

by:davelowndes
ID: 5704217
The comments here didn't answer the question which is why you cannot pass the reference to the connection object. Here's the answer from another PAQ:

From: afpcos
 Date: Tuesday, May 23 2000 - 10:06PM NZST  
You can not pass a connection out of the process in which it was created.

I am using connection pooling in my project.  I tried the same thing that you are talking about when I was first designed my project, about 9 months ago.  I was unsuccessfull in passing a connection between the exe and activex exe.  After calling Microsoft,  they advised that it is not possible to pass a connection out of process, such as from an exe to an active x exe or the other way around.

I am now managing the connection and all sql work in the active x exe passing back to the exe disconnected recordsets.  
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Introduction While answering a recent question (http://www.experts-exchange.com/Q_27402310.html) in the VB classic zone, I wrote some VB code in the (Office) VBA environment, rather than fire up my older PC.  I didn't post completely correct code o…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…

758 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now