Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Newbie ? on creating Dataset in VS 2005
Message
De
25/07/2006 15:55:05
 
 
Information générale
Forum:
ASP.NET
Catégorie:
ADO.NET
Versions des environnements
Environment:
C# 2.0
Divers
Thread ID:
01139720
Message ID:
01139926
Vues:
18
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
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform