To insert a DataRow
in a DataTable
only if it's unique on multiple columns in C#, you can use the DataTable.Select()
method to search for the matching rows before adding the new row. Here's an example code snippet:
main.cs647 chars22 lines
In this example, the Select()
method searches for rows that match the values "Value1" and 123 in columns "Column1" and "Column2", respectively. If no matching rows are found, the new DataRow
is added to the DataTable
.
gistlibby LogSnag