473,394 Members | 1,878 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

Internal .Net Framework Data Provider error 1

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
Apr 7 '06 #1
2 8103
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:%2***************@TK2MSFTNGP05.phx.gbl...
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

Apr 7 '06 #2
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" <je********@hotmail.com> wrote in message
news:eK**************@TK2MSFTNGP02.phx.gbl...
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:%2***************@TK2MSFTNGP05.phx.gbl...
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


Apr 7 '06 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Jonathan Woods | last post by:
I could not find Oracle .NET data provider for version 1.1. Do I have to use ODBC .NET data provider for instead? Which provider can offer best access to Oracle Database? I'm using Oracle 8i....
2
by: Doug | last post by:
We are using the .net framework data provider for SQL, but have hit a problem that we have not been able to solve regardless of the timeouts or conncetion pooling settings on the server. We...
10
by: Paul Deibel | last post by:
Hello I am working on a VB.Net project where I need to change the data provider from OLEDB to OracleClient. I am also looking to use "shaping" and I am looking for the equivalent to...
0
by: acwomble | last post by:
I am working with a database on another system via a ssh tunnel using plink. We have setup an alias the local system for the remote database. I am able to connect and work from within Visual...
2
by: bguthals | last post by:
Recieved the following error message. I'm not familiar with .Net and my co-workers haven't seen this error before. Maybe someone can clue me in on what is the problem. .Net SqlClient Data...
7
by: Peter Hann | last post by:
As far as I know VisualStudio contains a MS built-in data provider for accessing Oracle databases. Is this built-in MS data provider only in the "full" VisualStudio Edition or in the Express...
1
by: aj | last post by:
I'm trying to hook up some MS stuff to my DB2 LUW 8.2 FP14. Can anyone provide any guidance on .Net Framework Data Provider for DB2? Is there one? Where can I get it? I've been trawling thru...
2
by: Martin Racette | last post by:
Hi, I'm trying to make a programme that will use the above mentioned database, but I can not find how to create any relation between the tables, all there is in the database explorer is DATA...
2
by: Klaudiusz Bryja | last post by:
Hi I connect to Oracle 9.2 using System.Data.OracleClient. I call stored procedures and in cmd.ExecuteNonQuery I get error: "Internal .Net Framework Data Provider Error 30." StackTrace: in...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.