Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9119381
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T05:22:57+00:00 2026-06-17T05:22:57+00:00

I want to check if a particular row exists in Data table or not.

  • 0

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.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-17T05:22:59+00:00Added an answer on June 17, 2026 at 5:22 am

    DTF has rich classes to help you do these kinds of tests.

    Also see: MSI Tip: Authoring an ICE using C# / DTF

       using System;
        using Microsoft.Deployment.WindowsInstaller;
    
        namespace ConsoleApplication1
        {
            class Tester : IDisposable
            {
                Database _database;
    
                public Tester(string databasePath)
                {
                    _database = new Database(databasePath, DatabaseOpenMode.ReadOnly);
                }
    
                public void Dispose()
                {
                    _database.Dispose();
                }
    
                public bool HasTable(string tableName)
                {
                    return _database.Tables.Contains(tableName);
                }
    
                public bool HasColumn(string tableName, string columnName)
                {
                    bool columnExists = false;
                    if (HasTable(tableName))
                    {
                        columnExists = _database.Tables[tableName].Columns.Contains(columnName);
                    }
                    return columnExists;
                }
    
    
                public bool QueryReturnsData(string sqlStatement, params object[] args)
                {
                    return QueryReturnsData(string.Format(sqlStatement, args));
                }
    
                public bool QueryReturnsData(string sqlStatement)
                {
                    bool containsData = false;
                    using (View view = _database.OpenView(sqlStatement))
                    {
                        view.Execute();
                        using (Record rec = view.Fetch())
                        {
                            if(rec != null )
                            {
                                containsData = true;
                            }
                        }
                    }
                    return containsData;
    
                }
    
            }
        }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

In a table, I want to check if a particular column exists or not.
I want to check if a particular page gets redirected or not. However, whenever
I don't want check if an item with a value exists in the arraylist,
I am using vb.net and I want to check whether a particular user exists
I want to check whether a particular runtime type contains a property with a
I want to check whether a particular row in tree widget have parent and
i want to crate dynamic table which row contain two check boxes(custom check box)
I want to check a particular file exist in Azure Blob Storage. Is it
I want to check a particular website from various locations. For example, I see
I want to check if a particular char I get from the text field

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.