Solved

ADO Connection

Posted on 2000-02-22
3
153 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

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…
Introduction Raise your hands if you were as upset with FireMonkey as I was when I discovered that there was no TListview.  I use TListView in almost all of my applications I've written, and I was not going to compromise by resorting to TStringGrid…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

726 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