Monday, March 26, 2012

The component ADODB.Connection cannot be created.

I'm trying to migrate some code written in ASP.NET 1.14 to ASP.NET 2.0. We need to upgrade the Trust level as well and get rid of ASPCompat=True.

When I do this, I get this error: Is there an easy way around this error?

The component 'ADODB.Connection' cannot be created. Apartment threaded components can only be created on pages with an <%@dotnet.itags.org. Page aspcompat=true %> page directive.

Description:An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details:System.Web.HttpException: The component 'ADODB.Connection' cannot be created. Apartment threaded components can only be created on pages with an <%@dotnet.itags.org. Page aspcompat=true %> page directive.

Why not set the AspCompat="True" as the exception said?

Iori_Jay:

Why not set the AspCompat="True" as the exception said?

Yeh, thats a good question. Most of the ISP's in support of asp.net 2.0 are only supporting "Medium Trust". Noone will do "high trust" anymore. AspCompat requires High Trust. I realize the routine causing the problem is the generic class that processes the connections to the database. I guess this could be rewritten to use asp.net data connection algorithms, but the program code that calls the class is expecting a RecordSet.

So is my assumption that this would be a total rewrite correct to avoid aspcompat=True?

0 comments:

Post a Comment