Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

ADO Connection

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

Independent Software Vendors: 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

I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
You can of course define an array to hold data that is of a particular type like an array of Strings to hold customer names or an array of Doubles to hold customer sales, but what do you do if you want to coordinate that data? This article describes…
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…
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…
Suggested Courses

721 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