DataGrid automatice refresh

  • Thread starter Thread starter Dudi Nissan
  • Start date Start date
You'll need to requery the DB every 30 seconds then if you mean getting the
latest updates from the DB by refresh. Once you rerun your query, rebind
the grid.
 
Just use the Datasource and reset it to the new dataTable. Are you in
Winforms or the Web? If the web, you'll need to call DataBind afterward.

Let me know if you have any problem.

Bill
 
Hi,

I am in the web.
The code is:
Protected WithEvents dgrdTitles As
System.Web.UI.WebControls.DataGrid

Dim sqlConnectionString As String =
System.Configuration.ConfigurationSettings.AppSettings
("ConnectionString")

Private Sub Page_Load(ByVal sender As System.Object, ByVal
e As System.EventArgs) Handles MyBase.Load

Dim conObj As SqlConnection
Dim cmdSelect As SqlCommand
Dim dtrAlerts As SqlDataReader

' Retrieve records from database
conObj = New SqlConnection(sqlConnectionString)
conObj.Open()
cmdSelect = New SqlCommand("spSelectDetails",
conObj)
cmdSelect.CommandType = CommandType.StoredProcedure
dtrAlerts = cmdSelect.ExecuteReader()

dgrdTitles.DataSource = dtrAlerts
dgrdTitles.DataBind()

dtrAlerts.Close()
conObj.Close()
End Sub

Should I make endless loop and call DataBind ?

Thank you.
 
Back
Top