A
Aaron Ruhnow
I apologize in advance for the "newbie" question.
I have a simple ASP.NET application connecting to an access database.
On one page, the database is queried about 10 times each time it is
loaded. I have found that the page reads the DB and loads correctly
the first 4 times the page is loaded, but on the fifth time I receive
the always helpful error message "System.Data.OleDb.OleDbException:
Unspecified error".
I'm not sure what the problem is..I am sure the queries are correct
since the exact same queries run each time the page is loaded. My
guess is I am not disposing/closing the objects correctly and
connections to the database are hanging and I reach the maximum
allowed.
All the reads are from the OleDbDataReader object. The shared
function that performs the read is:
--------------------------------------------
Dim oUpdCmd As OleDbCommand
Dim tmpDR As OleDbDataReader
Dim m_oCn As OleDb.OleDbConnection
m_oCn = Nothing
m_oCn = New OleDbConnection(myAccessConnString)
m_oCn.Open()
oUpdCmd = New OleDbCommand(sSql, m_oCn)
tmpDR = oUpdCmd.ExecuteReader()
Return tmpDR
--------------------------------------------
Just in case, I Close() the Connection and DataReader objects as soon
as I am done with them. Is there something else that needs to be
done? I did not see any type of Close method attached to the
OleDbCommand object.
Also, my connection string is:
Provider=microsoft.jet.oledb.4.0;Data Source=C:\MyDB.mdb;
Thanks for the help.
I have a simple ASP.NET application connecting to an access database.
On one page, the database is queried about 10 times each time it is
loaded. I have found that the page reads the DB and loads correctly
the first 4 times the page is loaded, but on the fifth time I receive
the always helpful error message "System.Data.OleDb.OleDbException:
Unspecified error".
I'm not sure what the problem is..I am sure the queries are correct
since the exact same queries run each time the page is loaded. My
guess is I am not disposing/closing the objects correctly and
connections to the database are hanging and I reach the maximum
allowed.
All the reads are from the OleDbDataReader object. The shared
function that performs the read is:
--------------------------------------------
Dim oUpdCmd As OleDbCommand
Dim tmpDR As OleDbDataReader
Dim m_oCn As OleDb.OleDbConnection
m_oCn = Nothing
m_oCn = New OleDbConnection(myAccessConnString)
m_oCn.Open()
oUpdCmd = New OleDbCommand(sSql, m_oCn)
tmpDR = oUpdCmd.ExecuteReader()
Return tmpDR
--------------------------------------------
Just in case, I Close() the Connection and DataReader objects as soon
as I am done with them. Is there something else that needs to be
done? I did not see any type of Close method attached to the
OleDbCommand object.
Also, my connection string is:
Provider=microsoft.jet.oledb.4.0;Data Source=C:\MyDB.mdb;
Thanks for the help.