Solved

COM component using VB 6

Posted on 2001-09-13
13
158 Views
Last Modified: 2010-05-02
I've created a COM component(DBdata.dll) using VB6. This component returns a recordset when provided with a sql query.
But when I use it from a form it is giving the error - "Run-time error '429' ActiveX component cannot create object". what could be the reason ?
I have both form and class file in the same project.
I've added the 'References'
1. Microsoft ActiveX DataObjects 2.1 library
2. Microsoft ActiveX DataObjects Recordset 2.1 library
--------------------------------------------------------
Following is the code for the class file(getData.cls).

Public Function RS_result(ByVal strSQL As String) As ADODB.Recordset

Dim ad As ADODB.Connection
Dim ar As ADODB.Recordset

Set ad = New ADODB.Connection
Set ar = New ADODB.Recordset

Let ad.ConnectionString="provider=SQLOLEDB;data source=pdc;uid=starwar2001;pwd=captaincook;database=intranet"
ad.Open
ar.Open strSQL, ad

Set RS_result = ar

End Function
---------------------------------------------------------

Following is the code for the form (DataAccess.frm)

Private Sub Form_Load()
Set db  = CreateObject("DBdata.getData")
Data_result = db.RS_result("select firstname from M_EmployeeDetail Where empid=100")

Msgbox Data_result

End Sub

---------------------------------------------------------

But when i have the code in getData.cls in a .frm its working fine.

Hoping for a solution :)
regards
renjith
0
Comment
Question by:renjith
  • 4
  • 4
  • 2
  • +3
13 Comments
 
LVL 142

Expert Comment

by:Guy Hengel [angelIII / a3]
ID: 6479018
Open the .frm file once in an normal editor, like notepad.
Check if there are any references to older MDAC (ADO2.0, or even ADO1.x)...
Normally, all the references are in the .vbp file, but it happens that VB puts some of them to the .frm file...

Cheers
0
 
LVL 142

Expert Comment

by:Guy Hengel [angelIII / a3]
ID: 6479020
On the other hand, your DLL might not be build as binary compatible...
0
 
LVL 22

Expert Comment

by:CJ_S
ID: 6479023
2 options

- The component Dbdata.getData should be compiled and registered on the machine.
- you can have a project group in which you have both the application-project and the activex dll project. You can then set a reference to the activex dll by setting it in the application-project.

Regards,
CJ
0
 
LVL 1

Author Comment

by:renjith
ID: 6479068
I feel it has something to do with the Component and nothing to do with compilation and registration. Bocz the other components created in the same machine are working fine. But those components were not dealing with database and recordsets. Is there any other reference i've to make other than the above mentioned ones ?
I tried to use this component using ASP too, there its giving the error "wrong ProgID".
0
 
LVL 22

Expert Comment

by:CJ_S
ID: 6479100
I do not think the component is registered. Either that or you are using the wrong name.
0
 
LVL 1

Author Comment

by:renjith
ID: 6479596
How else can I confirm that the component is registered ?
0
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.

 
LVL 22

Expert Comment

by:CJ_S
ID: 6479634
go to Run -> regedit

search for "DBdata.getData"

Regards,
CJ
0
 
LVL 1

Author Comment

by:renjith
ID: 6481714
The component is not getting registered. Though after registering it gives confirmation as registration  successful, its not present in the Registry Editor. What could be the reason ?
0
 
LVL 22

Expert Comment

by:CJ_S
ID: 6481758
Your registry  might not update or visible changes. What you can do is place the .dll file in the same directory as the other executable.
0
 
LVL 1

Author Comment

by:renjith
ID: 6482407
I've tried placing the .dll file in the same
directory as the other executable still its not working.
Angell, what do u mean by "your DLL might not be build as binary compatible" ?
0
 
LVL 10

Expert Comment

by:GoodJun
ID: 6488481
separage your form from the class in different project.
you can't use Set db  = CreateObject("DBdata.getData") while they are in the same project.

you can use set db= new getdata if you keep them in the same project. (but when move to asp, you will need to separate them anyway.



0
 
LVL 49

Expert Comment

by:DanRollins
ID: 7208350
Hi renjith,
It appears that you have forgotten this question. I will ask Community Support to close it unless you finalize it within 7 days. I will ask a Community Support Moderator to:

    Refund points and save as a 0-pt PAQ.

renjith, Please DO NOT accept this comment as an answer.
EXPERTS: Post a comment if you are certain that an expert deserves credit.  Explain why.
==========
DanRollins -- EE database cleanup volunteer
0
 
LVL 5

Accepted Solution

by:
Netminder earned 0 total points
ID: 7241179
Per recommendation, points refunded and question closed.

Netminder
CS Moderator
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
Mysql vs Oracle 10 134
VBA saving file message display 5 56
How to set the row selection as it was prior leaving the datagrid in vb6 3 33
Passing a Text Box name to a Sub 6 69
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 While answering a recent question about filtering a custom class collection, I realized that this could be accomplished with very little code by using the ScriptControl (SC) library.  This article will introduce you to the SC library a…
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…

929 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

12 Experts available now in Live!

Get 1:1 Help Now