Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > Internal .Net Framework Data Provider error 1

Reply
Thread Tools

Internal .Net Framework Data Provider error 1

 
 
Andrew
Guest
Posts: n/a
 
      04-07-2006
Win2k3
IIS6
..NET 2.0

In my ASP.NET 2.0 app I create an open an SQL connection in the page's
constructor and call objSQL.Dispose() in the destructor. The SQLConnection
object is a class member of the page. Here's the destructor code:

/// Destructor
~Officer()
{
if( m_objConn != null )
m_objConn.Dispose();
}
/// End Destructor


When running this particular page through some testing I get the following
exception in the destructor at the "m_objConn.Dispose();" line:

System.InvalidOperationException was unhandled
Message="Internal .Net Framework Data Provider error 1."
Source="System.Data"
StackTrace:
at System.Data.ProviderBase.DbConnectionInternal.PreP ush(Object
expectedOwner)
at
System.Data.ProviderBase.DbConnectionPool.PutObjec t(DbConnectionInternal
obj, Object owningObject)
at
System.Data.ProviderBase.DbConnectionInternal.Clos eConnection(DbConnection
owningObject, DbConnectionFactory connectionFactory)
at System.Data.SqlClient.SqlConnection.Close()
at System.Data.SqlClient.SqlConnection.Dispose(Boolea n disposing)
at System.ComponentModel.Component.Dispose()
at Officer.Finalize() in c:\sys\projects\AddOfficer.aspx.cs:line 46

When I stop debugging VS2k5 pops up the JIT debugging dialog stating an
unhandled exception occurred in w3wp.exe.

1) Is this a bug?
2) Do I need a try/catch in a destructor? Is it good programming practice?
3) Why is this happening?
4) What is the meaning of life?


Any help is appreciated. TIA

Andrew


 
Reply With Quote
 
 
 
 
Jeff Dillon
Guest
Posts: n/a
 
      04-07-2006
You should never hold onto a connection for the life of a page. Open and
close the connection each time you need to. Let Connection Pooling work for
you.

Jeff

"Andrew" <andrew_test(dont spam its not cool)@hotmail.com> wrote in message
news:%(E-Mail Removed)...
> Win2k3
> IIS6
> .NET 2.0
>
> In my ASP.NET 2.0 app I create an open an SQL connection in the page's
> constructor and call objSQL.Dispose() in the destructor. The
> SQLConnection object is a class member of the page. Here's the destructor
> code:
>
> /// Destructor
> ~Officer()
> {
> if( m_objConn != null )
> m_objConn.Dispose();
> }
> /// End Destructor
>
>
> When running this particular page through some testing I get the following
> exception in the destructor at the "m_objConn.Dispose();" line:
>
> System.InvalidOperationException was unhandled
> Message="Internal .Net Framework Data Provider error 1."
> Source="System.Data"
> StackTrace:
> at System.Data.ProviderBase.DbConnectionInternal.PreP ush(Object
> expectedOwner)
> at
> System.Data.ProviderBase.DbConnectionPool.PutObjec t(DbConnectionInternal
> obj, Object owningObject)
> at
> System.Data.ProviderBase.DbConnectionInternal.Clos eConnection(DbConnection
> owningObject, DbConnectionFactory connectionFactory)
> at System.Data.SqlClient.SqlConnection.Close()
> at System.Data.SqlClient.SqlConnection.Dispose(Boolea n disposing)
> at System.ComponentModel.Component.Dispose()
> at Officer.Finalize() in c:\sys\projects\AddOfficer.aspx.cs:line 46
>
> When I stop debugging VS2k5 pops up the JIT debugging dialog stating an
> unhandled exception occurred in w3wp.exe.
>
> 1) Is this a bug?
> 2) Do I need a try/catch in a destructor? Is it good programming
> practice?
> 3) Why is this happening?
> 4) What is the meaning of life?
>
>
> Any help is appreciated. TIA
>
> Andrew
>
>



 
Reply With Quote
 
 
 
 
Andrew
Guest
Posts: n/a
 
      04-07-2006
Thanks for the connection pooling tip. However in this case I'm not sure
how it's relevant. More detail on the cause of the error and whether
destructors should have exception handling code would be helpful.

Thanks,
Andrew

"Jeff Dillon" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> You should never hold onto a connection for the life of a page. Open and
> close the connection each time you need to. Let Connection Pooling work
> for you.
>
> Jeff
>
> "Andrew" <andrew_test(dont spam its not cool)@hotmail.com> wrote in
> message news:%(E-Mail Removed)...
>> Win2k3
>> IIS6
>> .NET 2.0
>>
>> In my ASP.NET 2.0 app I create an open an SQL connection in the page's
>> constructor and call objSQL.Dispose() in the destructor. The
>> SQLConnection object is a class member of the page. Here's the
>> destructor code:
>>
>> /// Destructor
>> ~Officer()
>> {
>> if( m_objConn != null )
>> m_objConn.Dispose();
>> }
>> /// End Destructor
>>
>>
>> When running this particular page through some testing I get the
>> following exception in the destructor at the "m_objConn.Dispose();" line:
>>
>> System.InvalidOperationException was unhandled
>> Message="Internal .Net Framework Data Provider error 1."
>> Source="System.Data"
>> StackTrace:
>> at System.Data.ProviderBase.DbConnectionInternal.PreP ush(Object
>> expectedOwner)
>> at
>> System.Data.ProviderBase.DbConnectionPool.PutObjec t(DbConnectionInternal
>> obj, Object owningObject)
>> at
>> System.Data.ProviderBase.DbConnectionInternal.Clos eConnection(DbConnection
>> owningObject, DbConnectionFactory connectionFactory)
>> at System.Data.SqlClient.SqlConnection.Close()
>> at System.Data.SqlClient.SqlConnection.Dispose(Boolea n disposing)
>> at System.ComponentModel.Component.Dispose()
>> at Officer.Finalize() in c:\sys\projects\AddOfficer.aspx.cs:line 46
>>
>> When I stop debugging VS2k5 pops up the JIT debugging dialog stating an
>> unhandled exception occurred in w3wp.exe.
>>
>> 1) Is this a bug?
>> 2) Do I need a try/catch in a destructor? Is it good programming
>> practice?
>> 3) Why is this happening?
>> 4) What is the meaning of life?
>>
>>
>> Any help is appreciated. TIA
>>
>> Andrew
>>
>>

>
>



 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
HELP!!! .NET 2.0 - Problem with Web Service Complex Types - 500 Internal Server Error? Framework Bug??? Spam Catcher ASP .Net 4 07-06-2007 05:14 PM
ADO.NET on x64 error: Unable to find the requested .Net Framework Data Provider. It may not be installed. John Yung Windows 64bit 6 12-30-2005 03:57 PM
Informix .net provider - Sql server .net provider BS ASP .Net 3 06-17-2004 01:11 AM
.NET Framework Data Provider for SQL Server Doug ASP .Net 2 11-10-2003 09:00 PM
Transferring From Old e-mail Provider Account To A New One (different provider): Any Way To ? Robert11 Computer Support 0 06-26-2003 04:38 PM



Advertisments