Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
How To 'Move the pointer' in a DataSet
Message
 
 
À
12/03/2009 00:34:50
Information générale
Forum:
ASP.NET
Catégorie:
Code, syntaxe and commandes
Divers
Thread ID:
01386929
Message ID:
01387378
Vues:
46
>Cetin's example, using a BindingSource will work fine. But you don't have to use a BindingSource to get this to work, you just have to understand what it is that you missed.
>
>There are two ways (two different syntaxes) to specify databinding for any control if you're binding to a DataTable in a DataSet and this results in two distinct binding objects. The problem is that you can't mix and match ... you have to stay consistent throughout the form.
>
>So, in other words, if you bound your ListBox with:
>
>this.lstBackups.DataSource = _dsBackups;
>this.lstBackups.DataMember = "Backups";
>
>Then you have to use the following syntax with TextBoxes:
>
>this.txtDescription.DataBindings.Add("Text", _dsBackups, "Backups.LastName")
>
>
>But since you bound your ListBox with:
>
>this.lstBackups.DataSource = _dsBackups.Tables["Backups"];
>
>Then you must use this syntax for TextBoxes:
>
>this.txtDescription.DataBindings.Add("Text", _dsBackups.Tables["Backups"], "Description");
>
>
>The second option is the preferable methodology, BTW.
>

Aha! Thanks for explaining that.
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform