Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Filling tables in a dataset
Message
De
21/05/2006 23:01:39
 
 
À
18/05/2006 09:48:59
Information générale
Forum:
ASP.NET
Catégorie:
ADO.NET
Versions des environnements
Environment:
C# 2.0
Divers
Thread ID:
01123034
Message ID:
01123860
Vues:
17
Okay. Here's my part of the bargain. Here's the sample method to return the dataset with the data from 3 tableadapters. The class can be added to your data access layer in a partial class. Since all the generated code from table adapters is placed into a partial class that won't overwrite your partial class:
public partial class CustomersDataSet : DataSet
{
  public static CustomersDataSet GetCustomers()
  {
    CustomersTableAdapter custAdapter = new CustomersTableAdapter()
    OrdersTableAdapter orderAdapter = new OrdersTableAdapter()
    OrderDetTableAdapter orderDetAdapter = new OrderDetTableAdapter()

    CustomersDataSet customers = new CustomersDataSet();
    custAdapter.Fill(customers.Customers);
    ordAdapter.Fill(customers.Orders);
    detailsAdapter.Fill(customers.OrdDetails);
    return customers;
  }
}
>If you post, I'll post some of the code from the book I was reading before my Asp.net class started. It's on Winforms and databinding in 2.0.
>
>It was incredibly easy. Just drag both tables onto the Dataset design surface. There was a requirement to do a little coding if some instances so the tables get populated in the correct order.

>
>Hey, Perry...
>
>OK, deal. ;)
>
>I assume you're talking about the Brian Noyes book? If so, great book.
>
>A question - suppose you need to populate a typed DataSet for a non-visual component. Maybe you have a middle-tier component that retrieves data from a stored proc, and does some munging, or automated report-generation to a fil 10e...in any case, there's no form involved. Does the code handle that?
>
>Thanks,
>Kevin

(On an infant's shirt): Already smarter than Bush
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform