Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
C# Typed DataSet Questions
Message
From
20/04/2008 12:51:59
 
 
To
14/04/2008 12:49:04
Timothy Bryan
Sharpline Consultants
Conroe, Texas, United States
General information
Forum:
ASP.NET
Category:
Coding, syntax and commands
Miscellaneous
Thread ID:
01310405
Message ID:
01311961
Views:
24
>// 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
Bonnie Berent DeWitt
NET/C# MVP since 2003

http://geek-goddess-bonnie.blogspot.com
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform