Enterprise Library DAAB via COM

G

Guest

I have a .net 2005 class library project that relies upon the Data Access
Application Block from the 2006 Enterprise Library.

I want to call my project from a legacy VB6 application.

Simple calls from the VB6 project to the .net project work fine but any call
to a method that replies upon the DAAB fails with the message “The type
initializer for
'Microsoft.Practices.EnterpriseLibrary.Data.DatabaseConfigurationView' threw
an exception.â€

Please help me understand what is causing this. Thanks.
 
K

Kevin Yu [MSFT]

Hi,

Could you let me know how you exported your project to VB6? Did you used
type library exporter(Tlbexp.exe)?

Was the exception thrown on the dev machine or a client's machine? Was the
.NET framework and the Enterprise Library successfully installed on that
machine? Did you see the assemblies for DAAB appear in the GAC?

Please also let me know what type of exception did you get, so we can see
what is prevent the call from success. Thank you!

Kevin Yu
Microsoft Online Community Support

==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscriptions/managednewsgroups/default.aspx#notif
ications.
Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/subscriptions/support/default.aspx.
==================================================

(This posting is provided "AS IS", with no warranties, and confers no
rights.)
 
G

Guest

I checked the "Register for COM interop" checkbox.

Both client and server are running on my development machine. DAAB working
correclty in all other cases.

If I change the code on the server so it doesn't use DAAB then all works fine.

i.e.

This works:

Dim _cnn As New SqlConnection("Database=MIB;Server=(local);Integrated
Security=SSPI;")
_cnn.Open()
Try
Dim _cmd As New SqlCommand(m_StoredProcedureName, _cnn)
_cmd.CommandType = CommandType.StoredProcedure
_cmd.Parameters.Add(m_ParameterNameComputerName,
SqlDbType.Text).Value = ComputerName
_cmd.ExecuteNonQuery()
Finally
_cnn.Close()
End Try

This does not:

Dim _Database As Database = DatabaseFactory.CreateDatabase
With _Database
Dim _Cmd As SqlCommand =
..GetStoredProcCommand(m_StoredProcedureName)
.AddInParameter(_Cmd, m_ParameterNameComputerName,
DbType.String, ComputerName)
.ExecuteNonQuery(_Cmd)
End With

Thanks.
 
K

Kevin Yu [MSFT]

Hi,

Could you show me some more about the detailed information of the
exception? For example, the call stack and the detailed exception message
will be helpful. Or a screen shot is also good. I'm trying to see whether
this is a class library issue or interop issue.

By the way, is your class library single threaded or multiple threaded? As
VB6 only supports single threaded, any app attempt to use multiple threaded
will fail.

At mean time, please also check the following KB article

http://support.microsoft.com/kb/817248

It will be helpful. Thank you for your cooperation.

Kevin Yu
Microsoft Online Community Support

==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscriptions/managednewsgroups/default.aspx#notif
ications.
Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/subscriptions/support/default.aspx.
==================================================

(This posting is provided "AS IS", with no warranties, and confers no
rights.)
 
A

arunbjung

Dick said:
I have a .net 2005 class library project that relies upon the Data Access
Application Block from the 2006 Enterprise Library.

I want to call my project from a legacy VB6 application.

Simple calls from the VB6 project to the .net project work fine but any call
to a method that replies upon the DAAB fails with the message "The type
initializer for
'Microsoft.Practices.EnterpriseLibrary.Data.DatabaseConfigurationView' threw
an exception."

Please help me understand what is causing this. Thanks.
 
A

arunbjung

Hi ,
Has anybody found the solution to this problem.I am facing a very
similar problem.Could some one please help.
Thanks
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top