Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
C# Typed DataSet Questions
Message
From
20/04/2008 19:15:42
Timothy Bryan
Sharpline Consultants
Conroe, Texas, United States
 
 
To
20/04/2008 12:51:59
General information
Forum:
ASP.NET
Category:
Coding, syntax and commands
Miscellaneous
Thread ID:
01310405
Message ID:
01311990
Views:
14
>
>
>>// 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
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform