-
February 25th, 2014, 07:02 AM
#1
[VB.NET 4.0] System.Data.OleDb.OleDbException- system resources exceeded
Hello,
I have an aplication that checks in specific time if database file was changed and if the changes were made shows datatable in dgv
All code is given in Timer Tick. Unfortunately on each 1000 ticks I receive error - System.Data.OleDb.OleDbException (0x800045005) system resources exceeded.
I tried to make a code that dispose / close everything to prevent more than 1000 objects connections but still error appears
My sample code (I removed thingst that are not needed)
Code:
Try
Using Myconn As New System.Data.OleDb.OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;" & "Data Source=" & mypath & ";" & "Extended Properties=dBASE IV;")
Using Mycmd As New OleDb.OleDbCommand("SELECT * FROM " & Filename, Myconn)
Using Mydt As New DataTable
Using Myadapter As New OleDb.OleDbDataAdapter(Mycmd)
Myadapter.Fill(Mydt) <- CODE BREAK error System.Data.OleDb.OleDbException (0x800045005)
.....
Myadapter.Dispose()
GC.SuppressFinalize(Myadapter)
Myadapter.Dispose()
End Using
Mydt.Clear()
Mydt.Dispose()
Mydt.Clear()
GC.Collect()
GC.SuppressFinalize(Mydt)
Mydt.Dispose()
End Using
Mycmd.Dispose()
Mycmd.Connection = Nothing
GC.SuppressFinalize(Mycmd)
End Using
Mycn.ConnectionString = Nothing
Mycn.Close()
If Not cn Is Nothing Then
CType(Mycn, IDisposable).Dispose()
End If
GC.SuppressFinalize(Mycn)
Mycn.Dispose()
End Using
Catch ex1 As Exception
Timer1.Stop()
MessageBox.Show("Error occurred: " & vbCrLf & ex1.ToString)
Finally
GC.Collect()
End Try
Does anyone could help me solve this problem ?
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|