Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

ADO Connection

Posted on 2000-02-22
3
Medium Priority
?
158 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 150 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

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

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…
Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
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…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…

963 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