Solved

DataSet update via a TIMER

Posted on 2004-08-26
7
223 Views
Last Modified: 2010-04-23
Hi, I cannot seem to get a textbox to update on the timer value - the record count should go up and down, but it just stays the same:

...CODE FOR TIMER1
        Dim ready As String
   
        DataReadyPallets1.GetChanges()
        SqlDataAdapter1.Update(DataReadyPallets1)
        SqlDataAdapter1.Fill(DataReadyPallets1)
        ready = DataReadyPallets1.tblpallets.Rows.Count.ToString
        TextBox1.Text = " READY PALLETS: " & ready
        TextBox2.Text = Now()
...END

I know I am doing something foolish, but no time to figure it out.  Thanks!
0
Comment
Question by:Dan Flood
  • 4
  • 2
7 Comments
 
LVL 27

Expert Comment

by:planocz
ID: 11903561
ADD...

textbox2.refresh
0
 
LVL 14

Expert Comment

by:ptakja
ID: 11904513
The GetChanges method returns a DataTable object.  You need to pass that into your Update method like this:


    SqlDataAdapter1.Update(DataReadyPallets1.GetChanges())
0
 

Author Comment

by:Dan Flood
ID: 11906098
Hi,

This now causes an exception error and crashes the program :

      Dim ready As String

        SqlDataAdapter1.Update(DataReadyPallets1.GetChanges())     <-- NULL EXCEPTION ERROR.
        ready = DataReadyPallets1.tblpallets.Rows.Count.ToString
        TextBox1.Text = " READY PALLETS: " & ready
        TextBox2.Text = Now()

Also, the textbox2 is rfreshing OK - its a data issue.
0
Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 
LVL 27

Accepted Solution

by:
planocz earned 500 total points
ID: 11906188
  try something like this...

try
    SqlDataAdapter1.Update(DataReadyPallets1.GetChanges())     <-- NULL EXCEPTION ERROR.
        ready = DataReadyPallets1.tblpallets.Rows.Count.ToString
        TextBox1.Text = " READY PALLETS: " & ready
        TextBox2.Text = Now()
catch exp as  System.ArgumentNullException
'skip of null
end try
0
 

Author Comment

by:Dan Flood
ID: 11906410
That just hides the error, it doesn't fix the problem :-(

0
 

Author Comment

by:Dan Flood
ID: 11906431
Private Sub Timer1_Elapsed(ByVal sender As System.Object, ByVal e As System.Timers.ElapsedEventArgs) Handles Timer1.Elapsed

        Dim ready As String

        Try
            SqlDataAdapter1.Update(DataReadyPallets1.GetChanges())
            ready = DataReadyPallets1.tblpallets.Rows.Count.ToString
            TextBox1.Text = " READY PALLETS: " & ready
            TextBox2.Text = Now()
        Catch exp As System.ArgumentNullException
            TextBox1.Text = "Update Error."
        End Try
    End Sub
0
 

Author Comment

by:Dan Flood
ID: 11910176
I found the solution myself, but your comment was the closest to helping :) thanks
0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article explains how to create and use a custom WaterMark textbox class.  The custom WaterMark textbox class allows you to set the WaterMark Background Color and WaterMark text at design time.   IMAGE OF WATERMARKS STEPS Create VB …
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
This video shows how to quickly and easily add an email signature for all users on Exchange 2016. The resulting signature is applied on a server level by Exchange Online. The email signature template has been downloaded from: www.mail-signatures…

829 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question