Solved

DataSet update via a TIMER

Posted on 2004-08-26
7
222 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
Gigs: Get Your Project Delivered by an Expert

Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

 
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

Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

Question has a verified solution.

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

Suggested Solutions

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 …
This tutorial demonstrates one way to create an application that runs without any Forms but still has a GUI presence via an Icon in the System Tray. The magic lies in Inheriting from the ApplicationContext Class and passing that to Application.Ru…
In a recent question (https://www.experts-exchange.com/questions/28997919/Pagination-in-Adobe-Acrobat.html) here at Experts Exchange, a member asked how to add page numbers to a PDF file using Adobe Acrobat XI Pro. This short video Micro Tutorial sh…
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…

786 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