Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Grid and textbox not in sync
Message
De
08/12/2004 16:03:50
 
 
Information générale
Forum:
ASP.NET
Catégorie:
Formulaires
Divers
Thread ID:
00967844
Message ID:
00967861
Vues:
7
Yep ... that'll do the trick (but then don't forget the .AcceptChanges() after that).

~~Bonnie



>Thanks Bonnie,
>
>Tried calling the Adapter.Update and passing the changes table, and it worked:
>
>
>Dim oChanges as DataTable = Methods1.Tables("ExtraMethods").GetChanges()
>If Not oChanges Is Nothing Then
>  oAdapter.Update(oChanges)
>End If
>
>
>
>>Rick,
>>
>>The only thing that AcceptChanges() does is mark your DataSet has having no changes. It does nothing as far as updating your database. A DataSet is a disconnected object. That means it's totally disconnected from the database.
>>
>>~~Bonnie
>>
>>
>>
>>>Hi Hector,
>>>
>>>Now I cant get the textbox to actually update the database (sheesh! < g >).
>>>
>>>I was able to fix the sync problem with the line
>>>
>>>
>>>txtContent.DataBindings.Add("text", Methods1.Tables("ExtraMethods"), "Content")
>>>
>>>
>>>I have tried the following in both the LostFocus and the close of the form
>>>
>>>
>>>If Methods1.HasChanges Then
>>>   Methods1.AcceptChanges
>>>End If
>>>
>>>and
>>>
>>>Dim oChanges as DataTable = Methods1.Tables("ExtraMethods").GetChanges()
>>>If Not oChanges Is Nothing Then
>>>   oChanges.AcceptChanges()
>>>End If
>>>
>>>
>>>
>>>Any ideas??
>>>
>>>
>>>
>>>>Make sure they are both bound to the same object. What I mean is that, since there are several ways to bind to the grid, is that sometimes .NET does not realize that both of them are bound to the same object.
>>>>
>>>>Could you post the lines of code that do the binding for the textbox and the grid?
>>>
>>>
>>>
>>>
>>>>>I dropped a grid and a textbox onto a form, I bind the grid to a SQL Server table and i bind the textbox to a text field in the table.
>>>>>
>>>>>The grid fills fine and so does the text box, but when I navigate to a different row in the grid, the textbox is still bound to the original row
>>>>>
>>>>>TIA,
>>>>>
>>>>>Rick
>>>>
Bonnie Berent DeWitt
NET/C# MVP since 2003

http://geek-goddess-bonnie.blogspot.com
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform