Solved

DataSet update via a TIMER

Posted on 2004-08-26
7
220 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:jakyll
  • 4
  • 2
7 Comments
 
LVL 27

Expert Comment

by:planocz
Comment Utility
ADD...

textbox2.refresh
0
 
LVL 14

Expert Comment

by:ptakja
Comment Utility
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:jakyll
Comment Utility
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
What Security Threats Are You Missing?

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

 
LVL 27

Accepted Solution

by:
planocz earned 500 total points
Comment Utility
  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:jakyll
Comment Utility
That just hides the error, it doesn't fix the problem :-(

0
 

Author Comment

by:jakyll
Comment Utility
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:jakyll
Comment Utility
I found the solution myself, but your comment was the closest to helping :) thanks
0

Featured Post

Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

Join & Write a Comment

Well, all of us have seen the multiple EXCEL.EXE's in task manager that won't die even if you call the .close, .dispose methods. Try this method to kill any excels in memory. You can copy the kill function to create a check function and replace the …
Creating an analog clock UserControl seems fairly straight forward.  It is, after all, essentially just a circle with several lines in it!  Two common approaches for rendering an analog clock typically involve either manually calculating points with…
This video demonstrates how to create an example email signature rule for a department in a company using CodeTwo Exchange Rules. The signature will be inserted beneath users' latest emails in conversations and will be displayed in users' Sent Items…
You have products, that come in variants and want to set different prices for them? Watch this micro tutorial that describes how to configure prices for Magento super attributes. Assigning simple products to configurable: We assigned simple products…

771 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

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now