我想检查数据表中是否存在特定行。
例如,我想检查属性表是否存在于 msi 数据表中。如果它存在,那么我想检查“属性”列和“值”列是否存在。如果两者都存在,那么我想检查属性“ARPNOMODIFY”是否存在。
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.
}
}
我有一个数据表,其结构为(“TableName”,“ColumnNAme1”,“ColumnName2”,“ColumnName1 处的值”)。因此,对于上面的记录,该行就像 ("Property","Property","Value","ARPNOMODIFY") 并且我想返回值 1,因为 ARPNOMODIFY 存在并且它的值为 1。
现在将另一行视为 ("Property","Propery","Value","ICFAGREE")。现在,如果属性表中不存在 ICFAGREE 属性,那么我想返回空字符串。提前致谢。
还要考虑另一行(“AdminExecuteSequence”、“Action”、“Condition”、“SetSpecifiedDir”)。现在在此示例中,AdminExecuteSequence 表具有 Action 和 Condition 列。Action 列下的值之一是“SetSpecifiedDir”,因此它在“Condition”列下的对应值是“ORCADIR”。所以我想返回“ORCADIR”这个字符串,如果 AdminExecuteSequence 表中存在“SetSpecifiedDir”值,否则我将返回 null .