ADO.NET / Update Column in memory
-
Okay, I'm new to the whole ADO.NET stuff, so don't punish me to hard if I ask a total bullshit question... First, here's a piece of code (assume, aDataSet is already initialized and the table "aTable" also exists):
Dim aRow As DataRow aDataSet.Tables("aTable").Columns.Add("isParent", System.Type.GetType("System.Boolean")) For Each aRow In Me.mDataSet.Tables("aTable").Rows aRow.Item("isParent") = True Next
What I wanna do: Add the new column "isParent" to "aTable" (okay, I managed this), and initialize it with a standard value (I do this in the for-next-loop). But I thought, there must be a more elegant way to do this, without picking every single cell in a loop. Anyone know a good solution? I don't need to write in a database, 'cause my aDataSet is build on the fly, without database representation.
-
Okay, I'm new to the whole ADO.NET stuff, so don't punish me to hard if I ask a total bullshit question... First, here's a piece of code (assume, aDataSet is already initialized and the table "aTable" also exists):
Dim aRow As DataRow aDataSet.Tables("aTable").Columns.Add("isParent", System.Type.GetType("System.Boolean")) For Each aRow In Me.mDataSet.Tables("aTable").Rows aRow.Item("isParent") = True Next
What I wanna do: Add the new column "isParent" to "aTable" (okay, I managed this), and initialize it with a standard value (I do this in the for-next-loop). But I thought, there must be a more elegant way to do this, without picking every single cell in a loop. Anyone know a good solution? I don't need to write in a database, 'cause my aDataSet is build on the fly, without database representation.
DataColumn
has aDefaultValue
property.Navaneeth How to use google | Ask smart questions
-
DataColumn
has aDefaultValue
property.Navaneeth How to use google | Ask smart questions
It works fine, thanks.