Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Iterate Through DataSet Rows
Message
De
22/09/2008 00:48:05
 
Information générale
Forum:
ASP.NET
Catégorie:
Code, syntaxe and commandes
Versions des environnements
Environment:
C# 2.0
OS:
Windows XP SP2
Network:
Windows 2003 Server
Database:
MS SQL Server
Divers
Thread ID:
01348670
Message ID:
01349365
Vues:
17
DataBind your TextBox to the column you wish to display and set up a CurrencyManager:
txtKey.DataBindings.Add("Text", ds.Tables["Inventory"], "MyColumn"];

CurrencyManager oCurrency = (CurrencyManager)this.BindingContext[ds.Tables["Inventory"]);
Then, your Next/Previous buttons move the CurrencyManager position, and the txtKey textbox will automatically change:
// Next button
this.oCurrency.Position++;

// Previous button
this.oCurrency.Position--;
~~Bonnie




>I want to put a Next and Previous button on a form and allow the user to move to either the previous or next row in the data set. This will this display the contents of the row in textboxes on the form. So far I have:
>
>
>private void ShowRow(int iRow)
>{
>	DataRow row = ds.Tables["Inventory"].Rows[iRow - 1];
>	txtKey.Text = ???
>
>
>
>where 'ds' is a dataset stored to a private member on the form.
>
>1) Is this the way to do this?
>2) How to I get the data from the row into the text box?
>
>Thanks
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