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 7051697
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T03:17:40+00:00 2026-05-28T03:17:40+00:00

My C# .NET 3.5 application is throwing an unusual exception when executing OleDbCommand.ExecuteReader .

  • 0

My C# .NET 3.5 application is throwing an unusual exception when executing OleDbCommand.ExecuteReader. The application makes 5 similar queries of an Access 2007 database. Three of the queries execute without any problems; the other 2 cause exactly the same exception to be thrown.

This is a query that passes:

String query =
    "SELECT " +
        "bas.[BAS BACnet Object Type/Instance], " + // OBJECT_IDENTIFIER_ATTRIBUTE/ITEM_REFERENCE_ATTRIBUTE
        "bas.[BAS BACnet Object Name], " +          // USER_NAME_ATTRIBUTE
        "bas.[BAS Point List Description], " +      // DESCRIPTION_ATTRIBUTE
        "bas.[BAS Monitor Only], " +                // MONITOR_ONLY_ATTRIBUTE
        "ref.[ENUM_H], " +                          // PROPERTY_REFERENCE_VALUE_ATTRIBUTE
        "yk.[CCC Max Value (eng units)], " +        // MAX_PRESENT_VALUE_ATTRIBUTE
        "yk.[CCC Min Value (eng units)], " +        // MIN_PRESENT_VALUE_ATTRIBUTE
        "yk.[CCC Enum/Data Set], " +                // UNITS_ATTRIBUTE
        "ore.[ORE COV Increment], " +               // COV_INCREMENT_ATTRIBUTE
        "ore.[ORE Display Precision] " +            // DISPLAY_PRECISION_ATTRIBUTE
    "FROM (([OV2 BAS] AS bas " +
    "INNER JOIN [OV2 ORE] AS ore ON bas.[Ref ID] = ore.[Ref ID]) " +
    "INNER JOIN [OV2 RefID] AS ref ON bas.[Ref ID] = ref.[Ref ID]) " +
    "INNER JOIN [YK CAPP] AS yk ON bas.[Ref ID] = yk.[Ref ID] " +
    "WHERE bas.[BAS BACnet Object Type/Instance] LIKE 'AV%';";

this.RunQuery(query, MappingTable.AV_QUERY_IP_FIELDS, this.IPAnalogValuesList);

This is a query that throws throws an exception:

String query =
    "SELECT " +
        "bas.[BAS BACnet Object Type/Instance], " + // OBJECT_IDENTIFIER_ATTRIBUTE/ITEM_REFERENCE_ATTRIBUTE
        "bas.[BAS BACnet Object Name], " +          // USER_NAME_ATTRIBUTE
        "bas.[BAS Point List Description], " +      // DESCRIPTION_ATTRIBUTE
        "bas.[BAS Monitor Only], " +                // MONITOR_ONLY_ATTRIBUTE
        "ref.[ENUM_H], " +                          // PROPERTY_REFERENCE_VALUE_ATTRIBUTE
        "ses.[ENUM_H], " +                          // STATES_TEXT_ATTRIBUTE
        "ore.[ORE States] " +                       // ACTIVE_TEXT_ATTRIBUTE/INACTIVE_TEXT_ATTRIBUTE
    "FROM (([OV2 BAS] AS bas " +
    "INNER JOIN [OV2 RefID] AS ref ON bas.[Ref ID] = ref.[Ref ID]) " +
    "INNER JOIN [OV2 ORE] AS ore ON bas.[Ref ID] = ore.[Ref ID]) " +
    "INNER JOIN [StatesEnumSet] AS ses ON ore.[ORE States] = ses.[ID] " +
    "WHERE bas.[BAS BACnet Object Type/Instance] LIKE 'BV%';";

this.RunQuery(query, MappingTable.BV_QUERY_FIELDS, this.BinaryValuesList);

Here is how all of the queries are executed:

private void RunQuery(String query, Int32 fieldCount, Object target)
{
    OleDbCommand cmd = null;
    OleDbDataReader reader = null;

    try
    {
        OleDbConnectionStringBuilder connection = new OleDbConnectionStringBuilder();
        connection.Provider = "Microsoft.ACE.OLEDB.12.0";
        connection.DataSource = XML_Generator.Program.MappingTableFilename;
        connection.PersistSecurityInfo = false;

        this.DbConnection = new OleDbConnection(connection.ToString());
        this.DbConnection.Open();

        using (cmd = new OleDbCommand(query, this.DbConnection))
        {
            cmd.Connection = this.DbConnection;
            cmd.CommandText = query;
            cmd.CommandType = System.Data.CommandType.Text;
            reader = cmd.ExecuteReader(); // <== Exception is thrown here.

            while (reader.Read())
            {
                . . .
            }
        }

        if (this.DbConnection != null)
        {
            this.DbConnection.Close();
            this.DbConnection = null;
        }
    }
    catch (Exception e)
    {
        Console.WriteLine(e.ToString());
    }
}

This is the exception:

System.Data.OleDb.OleDbException: No value given for one or more required parame
ters.
at System.Data.OleDb.OleDbCommand.ExecuteCommandTextErrorHandling(OleDbHResul
t hr)
at System.Data.OleDb.OleDbCommand.ExecuteCommandTextForSingleResult(tagDBPARA
MS dbParams, Object& executeResult)
at System.Data.OleDb.OleDbCommand.ExecuteCommandText(Object& executeResult)
at System.Data.OleDb.OleDbCommand.ExecuteCommand(CommandBehavior behavior, Ob
ject& executeResult)
at System.Data.OleDb.OleDbCommand.ExecuteReaderInternal(CommandBehavior behav
ior, String method)
at System.Data.OleDb.OleDbCommand.ExecuteReader(CommandBehavior behavior)
at System.Data.OleDb.OleDbCommand.ExecuteReader()
at XML_Generator.MappingTable.RunQuery(String query, Int32 fieldCount, Object
target) in C:\ccmdb\prep\ov2_shared_cec_v1.0\ov2_shared_cec\Private\Tools\XML_G
enerator\XML_Generator\MappingTable.cs:line 312

Any help is appreciated. Thanks.

  • 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-05-28T03:17:41+00:00Added an answer on May 28, 2026 at 3:17 am

    Someone renamed one of the fields in the database. -_-

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

When my C# (.NET 3.5) application attempts to access a MS Access 2007 database
My ASP.NET v3.5 web application is throwing the following exception when it attempts to
A precompiled ASP.NET 2.0 (Visual Studio 2005) application is throwing this error when we
I've got an ASP.Net application, which starts throwing NUllReferenceExceptions, after a long period of
In standard ASP.net applications ASP.net offered some protection from XSS attacks with validateRequest throwing
My .NET application fails when run from a network drive even when the very
My .NET application (VB.NET 3.5 if you really must know) forms do not properly
I have an Asp.NET application (VS2008, Framework 2.0). When I try to set a
I have a ASP.NET application that we've written our own logging module for. My
Simple ASP.NET application. I have two drop-down controls. On the first-drop down I have

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.