Solved

ADO Connection

Posted on 2000-02-22
3
149 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
using Access 8 58
Delphi inherited method 6 60
SUM 2 INTEGER ARRAYS INTO 1 10 93
Visual Studio 2005 text editor 10 35
Enums (shorthand for ‘enumerations’) are not often used by programmers but they can be quite valuable when they are.  What are they? An Enum is just a type of variable like a string or an Integer, but in this case one that you create that contains…
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…
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 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…

932 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

21 Experts available now in Live!

Get 1:1 Help Now