Link to home
Start Free TrialLog in
Avatar of chrishui
chrishui

asked on

ODBC cannot read excel data?

Hi,
  I'm having some problem in reading data from excel spreadsheets.
  I'm writing a Visual C++ (6.0) application and using the CRecordset class to read data from a excel data file. However, I can only read the field names but nothing else. (i.e. no data can be read from the file). Whenever I used any ODBC functions to access the data file, I always got the return value "SQL_ERROR". I tried to use same method to read from other type of database files (Access, dBase, CSV, txt) and all works without any problem. Can anyone tell me why and how to solve this problem?

First of all, I'd like to add the descriptions about  Microsoft Excel terms definitions at the end of the question so that you can understand the question well. I can use SQLExecDirect, SQLBindCol and SQLFetch to get data from other type of database files but not Excel file(.xls).

A series of worksheet rows that contain related data, such as an invoice database or a set of client names and phone numbers. A list can be used as a database, in which rows are records and columns are fields. The first row of the list has labels for the columns.

About using a list as a database

In Microsoft Excel, you can easily use a list as a database. When you perform database tasks, such as finding, sorting, or subtotaling data, Microsoft Excel automatically recognizes the list as a database and uses the following list elements to organize the data.

·      The columns in the list are the fields in the database.
·      The column labels in the list are the field names in the database.
·      Each row in the list is a record in the database.

Avatar of inpras
inpras

this info is not enough U have to elaborate what UR doing how U have organized UR spread sheet and how are U accessing them what U meant field in excel ?? Pl be more explainative...
Avatar of chrishui

ASKER

Edited text of question.
Hi, I have add some comments to my question. I hope that will help you to understand by preblem.
Thanks alot.
ASKER CERTIFIED SOLUTION
Avatar of inpras
inpras

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial