Add DataRow into LookupTable
Hi
How can I add a new DataRow into a LookupTable or a DataTable?
You'd be performing these operations on the DataTable, so C# code would be best. A DataTable has both a Merge and an ImportRow method. The merge is faster and takes the two tables and essentially glues them together. If you want to import only specific rows, you can use the ImportRow method.
Here's a sample solution where I use both. Button 1 will use Merge and button 2 will use the ImportRow.
Comments
Keep up to date on this post and subscribe to comments
If you are using a LookupTable, there's an AddRecord method that allows you to add a new row. If you have used the DataTable from the LookupTable and wish to manipulate that (for example; you called GetTable to extract the DataTable object), you could add a DataRow object into that DataTable and then call ReplaceTable on the LookupTable to put it back.
The LookupTable is really designed to abstract the underlying DataTable, so in an automation, it is easier to use its methods than getting at the underlying DataTable.
- reply
You'd be performing these operations on the DataTable, so C# code would be best. A DataTable has both a Merge and an ImportRow method. The merge is faster and takes the two tables and essentially glues them together. If you want to import only specific rows, you can use the ImportRow method.
Here's a sample solution where I use both. Button 1 will use Merge and button 2 will use the ImportRow.
- reply