J
Joe C.
hello, thanks for reading.
this topic was probably covered in the past; if so, i apologize for
the repost, and would you kindly redirect me to the topic?
i have small app that monitors the state of a database. this is
achieved by a sql query running in timed increments, tied to the
"tick" event handler of the Timer control. basically, a sql query is
run every five seconds to get a count of items in a table.
the code used:
Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Timer1.Tick
Dim conn3 As New System.Data.SqlClient.SqlConnection(******)
Dim sqlString3 As String = "select count(recipient) from
board"
Dim adapter3 As New SqlDataAdapter(sqlString3, conn3)
Dim ds3 As New Data.DataSet
adapter3.Fill(ds3)
createTextIcon(CInt(ds3.Tables(0).Rows(0).Item(0))
adapter3.Dispose()
ds3.Clear()
End Sub
this achieves the desired result, but i noticed the memory usage
increases by about 12kb at each iteration. i imagine this is due to
the dataset [ds3] being filled. i thought that clearing the dataset
[ds3.clear()] would alleviate this issue, but it doesn't.
am i even going about this the right way? someone mentioned caching
the query. does anyone have any suggestions?
any help would be greatly appreciated.
-Joe.
this topic was probably covered in the past; if so, i apologize for
the repost, and would you kindly redirect me to the topic?
i have small app that monitors the state of a database. this is
achieved by a sql query running in timed increments, tied to the
"tick" event handler of the Timer control. basically, a sql query is
run every five seconds to get a count of items in a table.
the code used:
Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Timer1.Tick
Dim conn3 As New System.Data.SqlClient.SqlConnection(******)
Dim sqlString3 As String = "select count(recipient) from
board"
Dim adapter3 As New SqlDataAdapter(sqlString3, conn3)
Dim ds3 As New Data.DataSet
adapter3.Fill(ds3)
createTextIcon(CInt(ds3.Tables(0).Rows(0).Item(0))
adapter3.Dispose()
ds3.Clear()
End Sub
this achieves the desired result, but i noticed the memory usage
increases by about 12kb at each iteration. i imagine this is due to
the dataset [ds3] being filled. i thought that clearing the dataset
[ds3.clear()] would alleviate this issue, but it doesn't.
am i even going about this the right way? someone mentioned caching
the query. does anyone have any suggestions?
any help would be greatly appreciated.
-Joe.