G
Guest
I am having a problem with massive memory usage when running a series of
INSERT statement. This started in VB6 using ADO and Access, then I moved to
VB.NET using ADO, then to ADO.NET and then to SQL instead of Access. I have
scoured the search engines looking for a solution and can't seem to find one
if it's available.
Basically it appears that each time the routine runs a little more memory on
the workstation is chewed up. I can watch the pagefile usage grow in task
manager. This is about the 50th iteration I have tried. I have tried with
and without the opens and closes, I tried putting it in a transaction. The
workstation is XP Pro with all the patches.
Any ideas would be appreciated.
Public Sub Add(ByVal Number As Long, ByVal Group As Long, ByVal Subject As
String)
Dim intRecords As Integer
cnAdd = New SqlConnection(strConn)
cmdAdd = New SqlCommand
cmdAdd.Connection = cnAdd
cmdAdd.CommandText = "INSERT INTO ImageList values (" &
Number.ToString & ", " & Group.ToString & ", '" & Subject & "')"
Try
cnAdd.Open()
intRecords = cmdAdd.ExecuteNonQuery
cmdAdd.Dispose()
cnAdd.Close()
Catch ex As Exception
System.Diagnostics.Debug.WriteLine(ex.Message)
End Try
cnAdd.Dispose()
cnAdd = Nothing
End Sub
INSERT statement. This started in VB6 using ADO and Access, then I moved to
VB.NET using ADO, then to ADO.NET and then to SQL instead of Access. I have
scoured the search engines looking for a solution and can't seem to find one
if it's available.
Basically it appears that each time the routine runs a little more memory on
the workstation is chewed up. I can watch the pagefile usage grow in task
manager. This is about the 50th iteration I have tried. I have tried with
and without the opens and closes, I tried putting it in a transaction. The
workstation is XP Pro with all the patches.
Any ideas would be appreciated.
Public Sub Add(ByVal Number As Long, ByVal Group As Long, ByVal Subject As
String)
Dim intRecords As Integer
cnAdd = New SqlConnection(strConn)
cmdAdd = New SqlCommand
cmdAdd.Connection = cnAdd
cmdAdd.CommandText = "INSERT INTO ImageList values (" &
Number.ToString & ", " & Group.ToString & ", '" & Subject & "')"
Try
cnAdd.Open()
intRecords = cmdAdd.ExecuteNonQuery
cmdAdd.Dispose()
cnAdd.Close()
Catch ex As Exception
System.Diagnostics.Debug.WriteLine(ex.Message)
End Try
cnAdd.Dispose()
cnAdd = Nothing
End Sub