title: how to clear off gridview?
body: <p>I'm creating a dynamic gridview function which will bind different tables from DB into a datatable and then assign the datatable to the gridview! This is how it works, i have a dropdownlist, gridview and a button, the button will fire specific function based on the dropdownlist selection and then gridview will bind the data, my problem is that, when u press the button for the 1st time, the gridview will bind the data from DB, for second time pressing, the gridview will duplicate the data from the data of 1st time pressing! how do i clear off the gridview to avoid data duplication?</p>
  
  <pre><code>Private Sub Login()
      sSql = "" &amp; _
      "SELECT TYPE, SUBTYPE, LOGTS, ACTION, USERID, STAT1 " &amp; _
      "FROM i_LOG " &amp; _
      "WHERE TYPE = 'USR' AND SUBTYPE = 'LOG' " &amp; _
      "AND CONVERT(VARCHAR(20), LOGTS, 103) &gt;= '" &amp; txtDTFrom.Text &amp; _
      "' AND CONVERT(VARCHAR(20), LOGTS, 103) &lt;= '" &amp; txtDTTo.Text &amp; "'"
  
      DT = CreateDataTable(sSql)     'Retrieve from database.
  
      Session(sSesDT) = DT
      GVM.DataTable = DT
      GVM.GVAddEmptyRow()
  
      Dim seq As New BoundField
      Dim Type As New BoundField
      Dim SubType As New BoundField
      Dim Logts As New BoundField
      Dim action As New BoundField
      Dim user As New BoundField
      Dim status As New BoundField
  
      seq.HeaderText = GVM.DTNumberField
      seq.DataField = GVM.DTNumberField
  
      Type.HeaderText = "Type"
      Type.DataField = "TYPE"
  
      SubType.HeaderText = "Subtype"
      SubType.DataField = "SUBTYPE"
  
      Logts.HeaderText = "Date and Time"
      Logts.DataField = "LOGTS"
  
      action.HeaderText = "Action"
      action.DataField = "ACTION"
  
      user.HeaderText = "User ID"
      user.DataField = "USERID"
  
      status.HeaderText = "Status"
      status.DataField = "STAT1"
  
      gv.AutoGenerateColumns = False
      gv.Columns.Add(Type)
      gv.Columns.Add(SubType)
      gv.Columns.Add(Logts)
      gv.Columns.Add(action)
      gv.Columns.Add(user)
      gv.Columns.Add(seq)
      gv.Columns.Add(status)
  
      gv.DataSource = Session(sSesDT)
      gv.DataBind()
  End Sub
  
  Private Overloads Function CreateDataTable(ByVal sSql As String) As DataTable
      Dim DA As New OleDb.OleDbDataAdapter
      Dim dtDataTbl As New DataTable
      Dim dcDataCol As New DataColumn
  
      With DBMgr
          .openCnn()
          .SQL = sSql
          .openRst()
          DA.Fill(dtDataTbl, .rst)
      End With
  
      '==Adding Columns==
      dcDataCol = New DataColumn  'No
      With dcDataCol
          .DataType = GetType(Int32)
          .ColumnName = GVM.DTNumberField
          .AutoIncrement = True
          '.AllowDBNull = True
      End With
      dtDataTbl.Columns.Add(dcDataCol)
      '**Adding Columns**
  
      Return dtDataTbl
  End Function
  </code></pre>