Smart questions
Smart answers
Smart people
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Member Login

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips now!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

Join Tek-Tips
*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

LINK TO THIS FORUM!

Add Stickiness To Your Site By Linking To This Professionally Managed Technical Forum.
Just copy and paste the
code below into your site.

Partner With Us!

"Best Of Breed" Forums Add Stickiness To Your Site
Partner Button
(Download This Button Today!)

Feedback

"...I really enjoy your site. You have a lot of helpful and friendly experts who contribute so willingly. Thank you for past (and future) technical advice..."

Geography

Where in the world do Tek-Tips members come from?
SBTBILL (Programmer)
20 Jul 12 16:03
I've set up a 3 grid screen. The top grid should control the other 2 grids.
I get the current record of the top grid with this line.

mitem = dv1(cma.Position)("sponsor_id")

It bings me the correct information

I then call 2 routines to populate 2 datatables

I have code to empty the datatables at the beginning of each routine
a_tmpf3.Clear()

I run a select statement to get the data I want.

I then clear the grids and reset the data source
grddistributors.EndEdit()
grddistributors.DataSource = Nothing
grddistributors.Rows.Clear()
grddistributors.Refresh()
grddistributors.DataSource = a_tmpf3.DefaultView 'G2.Tables("thedists")
grddistributors.Refresh()

No mater what I've tried what happens is that the previous data stays and the new data is added. All I want is the new data.






jebenson (TechnicalUser)
23 Jul 12 10:53
Please show the code where you fill the datatables.

I used to rock and roll every night and party every day. Then it was every other day. Now I'm lucky if I can find 30 minutes a week in which to get funky. - Homer Simpson

Arrrr, mateys! Ye needs ta be preparin' yerselves fer Talk Like a Pirate Day!

SBTBILL (Programmer)
23 Jul 12 14:19
grabline = "Select gs.theyear, "
grabline = grabline & " gs.sponsor_id, "
grabline = grabline & " gs.lvl, "
grabline = grabline & " gs.april, "
grabline = grabline & " gs.may, "
grabline = grabline & " gs.june, "
grabline = grabline & " gs.july, "
grabline = grabline & " gs.august, "
grabline = grabline & " gs.september, "
grabline = grabline & " gs.october, "
grabline = grabline & " gs.november, "
grabline = grabline & " gs.december, "
grabline = grabline & " gs.january, "
grabline = grabline & " gs.february, "
grabline = grabline & " gs.march, "
grabline = grabline & " gs.total "
grabline = grabline & " from distributors.dbo.history_gsv_by_levels gs "
grabline = grabline & " left outer join distributors.dbo.distributors gh "
grabline = grabline & " on "
grabline = grabline & " gs.sponsor_id = "
grabline = grabline & " gh.dist_id "
grabline = grabline & " left outer join distributors.dbo.diststats gd "
grabline = grabline & " on "
grabline = grabline & " gs.sponsor_id = gd.dist_id "
'If Len(Trim(mcriteria)) > 0 Then
'grabline = grabline & " where " & mcriteria
'End If
grabline = grabline & " where gs.theyear = '" & myear & "' "
grabline = grabline & " and "
grabline = grabline & " gs.sponsor_id = " & mitem
grabline = grabline & " order by gs.sponsor_id,gs.lvl "
Try
GRAB.Open()
Catch
End Try

Dim grab2a As New SqlCommand(grabline, GRAB)
'
Dim G1a As New SqlDataAdapter(grab2a)
Dim G2a As New DataSet
'
G1a.Fill(G2a, "THElevels")
SBTBILL (Programmer)
23 Jul 12 18:45
I think I've found the problem. I defined the dataset at the start of the program rather then in the subroutine. That caused the table to just grow.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members!

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close