Solved

DataSet update via a TIMER

Posted on 2004-08-26
7
225 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

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…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
Add bar graphs to Access queries using Unicode block characters. Graphs appear on every record in the color you want. Give life to numbers. Hopes this gives you ideas on visualizing your data in new ways ~ Create a calculated field in a query: …
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…

717 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