Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Newbie ? on creating Dataset in VS 2005
Message
From
25/07/2006 15:55:05
 
General information
Forum:
ASP.NET
Category:
ADO.NET
Environment versions
Environment:
C# 2.0
Miscellaneous
Thread ID:
01139720
Message ID:
01139926
Views:
15
Hi, Dmitry,

Adding data (through code) to strongly-typed datasets is pretty easy.

For instance, suppose I have a dataset for an aging report. One of the tables is an aging bracket definiton, with columns for start day number, end day number, bracket number, description....I can do the following:
     // I have an aging report called dsAgingReport, with a table called dtBrackets

     dsAgingReport odsAgingReport = new dsAgingReport();

     odsAgingReport.dtBrackets.AdddtBracketsRow( 1, 30,  1, "< 30 days");
     odsAgingReport.dtBrackets.AdddtBracketsRow(31, 60, 2, "31-60 days");
I can do this, because Visual Studio 2005 automatically creates methods when I define a strongly-typed DataTable. Note the method is called called AddDtBracketsRow: VS2005 builds the method automatically, and establishes the parameters based on the columns in the DataTable.


Also, you can add a row by using the strongly-typed row and column objects:
dsAgingReport odsAgingReport = new dsAgingReport();
dsAgingReport.dtBracketsRow oNewRow = odsAgingReport.dtBrackets.NewdtBracketsRow();
oNewRow.StartDay = 1;
oNewRow.Endday = 30;
oNewRow.BracketLabel = " < 30 days ";
oNewRow.BracketNumber = 1;
odsAgingReport.dtBrackets.Rows.Add(oNewRow);
Hope that helps...
Kevin
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform