Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Dataadapter insert
Message
De
27/09/2013 12:10:00
 
 
À
27/09/2013 11:30:23
Information générale
Forum:
ASP.NET
Catégorie:
Bases de données
Versions des environnements
Environment:
VB 9.0
OS:
Windows Server 2012
Network:
Windows 2008 Server
Database:
MS SQL Server
Application:
Web
Divers
Thread ID:
01584280
Message ID:
01584334
Vues:
36
>>Hi, Don,
>>
>>If you need to manually add rows to an ADO.NET data table, you need to use the ADO.NET object model.
>>
>>Here is a very simple example of an established DataTable with 2 columns for ID and Name...you'll need to adapt it to your application.
>>
>>This is basically an "untyped dataset" as opposed to a strongly typed dataset. Typed datasets are often better, but it's best to get the basics down first. Suppose your data table has 2 columns for ID and Name.
>>
>>
>>DataRow dr = dt.NewRow();
>> dr["ID"] = 1;
>> dr["Name"] = "Kevin";
>> dt.Rows.Add(dr);
>>
>>
>>So if you need to add rows to a table before binding the ADO.NET datatable to a grid, that's a very simple example.
>
>Thanks Kevin, I can work with that. Is the dataadapter insert command only used when you need to send new data back to the source table?
>Also, any ideas on how to resort the dt after the new row is added?

Take a look at the Datatable.DefaultView property. It provides functionality for sorting/filtering.
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform