I want to check if a particular row exists in Data table or not.
E.g., I want to check if Property Table Exists in msi data table or not. If it exists then I want to check if “Property” column and “Value” column exists or not. If both exists then I want to check if Property “ARPNOMODIFY” exists or not.
if (database.Tables.Contains("Property"))
{
if (database.Tables["Property"].Columns.Contains("Property"))
{
// here I want to checked if "ARPNOMODIFY" or any other property exists or not. If it exists then I want its value.
}
}
I have one data table having structure as( “TableName”,”ColumnNAme1″,”ColumnName2″,”Value at ColumnName1″). So for above record the row is like (“Property”,”Property”,”Value”,”ARPNOMODIFY”) and I want to return Value 1 as ARPNOMODIFY exists and its value is 1.
Now consider another row as (“Property”,”Propery”,”Value”,”ICFAGREE”). Now if ICFAGREE property doesn’t exists in Property table then I want to return null string.
Thanks in advance.
Also Consider another row (“AdminExecuteSequence”,”Action”,”Condition”,”SetSpecifiedDir”). Now in this example AdminExecuteSequence table has Action and Condition columns. One of value under Action columns is “SetSpecifiedDir” so its corresponding value under “Condition” column is “ORCADIR”.So I want to return “ORCADIR” this string, If “SetSpecifiedDir” value exists in AdminExecuteSequence table or else I would return null.
DTF has rich classes to help you do these kinds of tests.
Also see: MSI Tip: Authoring an ICE using C# / DTF