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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T23:38:36+00:00 2026-06-02T23:38:36+00:00

I am querying an Excel file to retrieve data record and display them in

  • 0

I am querying an Excel file to retrieve data record and display them in a monitoring tool. The thing is that whenever I am trying to select a record with its id, with the following request, it throws an error when executing the query:

ExecuteCommandTextErrorHandling

telling me that the type in the query and the target cell are not compatible.

My request looks like

SELECT TOP 20 [Fields...] 
FROM [RECORD$] 
WHERE (([id] = '1'))

The id column can contains more than just numbers so its cell type is the default type which is standard.

My question is: how can I fetch the record without knowing its type before?

Do I have to enforce the column type, if so how? Do I have to catch the exception and retry without the quotes ?

Here is the code used to query the Excel file and my connection string

 public static DataTable queryXlsFile(String query, OleDbConnection dbConnection)
 {
        OleDbDataAdapter dbCommand = new OleDbDataAdapter(query, dbConnection);
        DataTable dt = new DataTable();
        dbCommand.Fill(dt);
        return dt;
    }

Provider=Microsoft.ACE.OLEDB.12.0; data source=C:\\test\\321.xls; Extended Properties=\"Excel 8.0;HDR=Yes;\";

Thanks in advance.

  • 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-02T23:38:38+00:00Added an answer on June 2, 2026 at 11:38 pm

    try adding IMEX=1;

    HDR=Yes;IMEX=1″

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

Sidebar

Related Questions

I am querying a database for results and trying to convert them into JSON
i am trying to insert data from excel sheet into database in java. for
I'm querying an online service (google data feed) which can return results that will
I am querying the ContactsContract.Data table in Android using a ListView to display the
So I have learned that that the Microsoft.Jet.OLEDB.4.0 data provider for querying data sources
I'm trying to import tariff information from an Excel file into a DataTable to
I'm querying a SQL db from excel using vba, that all works fine but
i'm querying a database like this: SELECT * from Log WHERE cookieId IN (select
I'm querying an MFC implemented COM object that is implemented as follows: class CA
I am querying a Picasa gallery and when I dig into the entries that

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.