Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Adding a new record to a datatable in a dataset
Message
De
14/11/2002 11:19:46
 
 
À
14/11/2002 11:13:49
Rex Mahel
Realm Software, Llc
Ohio, États-Unis
Information générale
Forum:
ASP.NET
Catégorie:
ADO.NET
Divers
Thread ID:
00722704
Message ID:
00722719
Vues:
12
Rex,

It's kinda screwy the way it works ... not only do you have to use .NewRow, but you also have to do an Add after.
DataRow row = objDataSet.Tables(TableName).NewRow()
-- do stuff with your row object, then add to the Rows collection
objDataSet.Tables(TableName).Rows.Add(row)
Seems silly to me to have to do it that way, but ... there it is ....

HTH,
~~Bonnie



>All,
>
>I have a blank DataTable (TableName) in a DataSet (objDataSet) to which I want to add an empty row. I filled the DataSet from a parameterized select statement with a parameter value which cannot be in the table. I check for the existance of the table before I try to add a new row. I use the following comamnd:
>
>objDataSet.Tables(TableName).NewRow()
>
>After the above is executed I check the rowcount and it is still 0. I have placed the command in a Try block, and no errors were caught.
>
>What am I doing wrong?
>
>TIA
>
>Rex
Bonnie Berent DeWitt
NET/C# MVP since 2003

http://geek-goddess-bonnie.blogspot.com
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform