Solved

RESHOWING ADOGRID  WITHOUT CLOSING DATARECORD/FIEL

Posted on 2004-09-14
4
286 Views
Last Modified: 2008-02-01
I have a large (30000 records) file,  opening /reading in adogrid takes 2 to 3 minutes, can live with that, but,  see source what I have to do after insert/update/delete,
if I don't close the file only file gets (unvisible) uopdated, not the adogrid, thus still
showing the old data
So what would be the way to update both without closing????

Private Sub cmdSave_Click()
'============================
Dim book As Long
Customgrid.Col = 0        
DebNum = Trim(txtCustomerId) '  is key for record on form
book = Customgrid.Bookmark
If book > 100 Then book = book - 100 Else book = 0 ' to make sure we
rsCustomers.MoveFirst                              ' are not passing gridposition
rsCustomers.Move book

'=====  
readFile:
'=====
 rsCustomers.MoveNext
 If rsCustomers.EOF Or rsCustomers.BOF Then Exit Sub
 If rsCustomers.Fields(0) = DebNum Then
   rsCustomers.Fields(3) = Left$(txtName1 + Space$(40), 40)
   rsCustomers.Fields(4) = Left$(txtStreet1 + Space$(40), 40)
   rsCustomers.Fields(5) = Left$(txtCity1 + Space$(30), 30)
   rsCustomers.Update
   rsCustomers.Save
  Customgrid.Refresh                   ' will do nothing see below remm
  rsCustomers.Close                    ' if these 5 lines are remmed
Set rsCustomers = Nothing         ' adogrid is not updated only database
rsCustomers.Source = ""             ' BUT reloading
dbCustomersActive = 0               ' after update takes so long!!!
Call Form_Load                  
      Else                        
  GoTo readFile
End If
End Sub

0
Comment
Question by:BIAPRO
  • 2
  • 2
4 Comments
 
LVL 6

Expert Comment

by:PreachDotNet
ID: 12063688
You could use a form level dataset if you are using .net, make all your changes to the local copy and then have a submit button to update the changes in the central repository.  The data adapter and its update command are excellent for this kind of thing.

Dont forget to call the refresh method of the ado grid.

0
 

Author Comment

by:BIAPRO
ID: 12063718
I'm using VB6,
could you please give a (small) sample how syntax would look like?
Thanks  Jack
0
 
LVL 6

Accepted Solution

by:
PreachDotNet earned 500 total points
ID: 12064049
I dont think it will work in VB6 sorry.
I made the move from vb6 to .net in about 2 weeks, dont be scared of the move :)

'Form level recordset
Dim rsCustomers as recordset

Form Load
adoGrid1.Bind rsCustomers

Button1_Press
'Update your local recordset
adoGrid1.Bind rsCustomers

Button_Submit Press
'Update remote database code here

That kind of thing, sorry I dont have time to try it out or thrash it out, somedays im slightly less than useless ;)

i think
0
 

Author Comment

by:BIAPRO
ID: 12091948
I forgot about  ADO, jumped to active X.  That will work, just some more work.
Thanks anyway
0

Featured Post

Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

Join & Write a Comment

Suggested Solutions

Here we come across an interesting topic of coding guidelines while designing automation test scripts. The scope of this article will not be limited to QTP but to an overall extent of using VB Scripting for automation projects. Introduction Now…
Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
In this fifth video of the Xpdf series, we discuss and demonstrate the PDFdetach utility, which is able to list and, more importantly, extract attachments that are embedded in PDF files. It does this via a command line interface, making it suitable …
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…

708 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

18 Experts available now in Live!

Get 1:1 Help Now