Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
C# Typed DataSet Questions
Message
De
20/04/2008 19:15:42
Timothy Bryan
Sharpline Consultants
Conroe, Texas, États-Unis
 
 
À
20/04/2008 12:51:59
Information générale
Forum:
ASP.NET
Catégorie:
Code, syntaxe and commandes
Divers
Thread ID:
01310405
Message ID:
01311990
Vues:
15
>
>
>>// If you want to change the data manually in code
>>// Initialize your dataset and fill it.
>>// Get the table out.
>>DataTable dtCustomers = DataSet.Tables[0];
>>// or
>>DataTable dtCustomers = DataSet.Tables["Customers"];
>>// Create a new row
>>DataRow newRow = dtCustomers.NewRow();
>>// Edit the column values
>>newRow["FirstName"] = "John";
>>newRow["LastName"] = "Jones";
>>// Add the row back to the table
>>after setting all the columns
>>dtCustomer.Rows.Add(newRow);
>>// Call accept changes on the DataSet
>>dsCustomers.AcceptChanges();
>

>
>Tim, I have to comment on your above suggestion. Accepting the Changes at this point is not a good idea if one is planning on sending the updates to the backend database.
>
>
>>>3) Could someone point me to examples of binding the DS to form controls?
>>
>>There are lots of ways to do this. Here is one:
>>lstCustomers.DataSource = dsCustomers;
>>lstCustomers.DisplayMember = "Customers.CustomerName";

>
>Just an FYI, but see my reply to Kevin about this (I cc'd you).
>
>~~Bonnie

Agreed on both counts. I was doing a little too much multi tasking at that moment.
Tim
Timothy Bryan
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform