title: How to make correctly in VB NET function to refresh data from SQL Server in some interval (timer)
body: <p>I have a some code for checking data from sql server every 5 sec.
  It is actually good, but I see that memmory usage is growing slowly? What can cause this?</p>
  
  <p>It is simple code:
  Public LastID as integer=0
  Public NewID as integer=0       </p>
  
  <p>Private Sub Timer1_Tick(sender As Object, e As EventArgs) Handles TimerSken.Tick</p>
  
  <pre><code>    Dim com As New SqlCommand("Select * from Products  where datediff(second,FinishedDate, GETDATE())&lt;7 order by ID desc", Connection)
      Dim ad As New SqlDataAdapter(com)
      Dim tableTimer As New DataTable()
      ad.Fill(tableTimer)
  
      If tableTimer.Rows.Count = 0 Then
          Return
      End If
  
      NewID = tableTimer.Rows.Item(0)("ID")
  
      If LastID &lt;&gt; NewID Then
  
          Dim Tittle As String = tableTimer.Rows.Item(0)("Operator").ToString &amp; ", " &amp; tableTimer.Rows.Item(0)("FinishedDate").ToString
          Dim text As String = tableTimer.Rows.Item(0)("Customer").ToString &amp; ", " &amp; tableTimer.Rows.Item(0)("WorkID").ToString &amp; vbNewLine &amp; tableTimer.Rows.Item(0)("Product").ToString &amp; ", " &amp; tableTimer.Rows.Item(0)("Operation").ToString
          LastID = NewID
  
          Notification.Show(Me, info.Caption = Tittle, info.Text = text)
      End If
  
  End Sub
  </code></pre>
  
  <p>Is it ok that all this I put inside timer?</p>