Solved

ODBC cannot read excel data?

Posted on 2000-02-29
4
280 Views
Last Modified: 2013-11-20
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.

0
Comment
Question by:chrishui
  • 2
  • 2
4 Comments
 
LVL 4

Expert Comment

by:inpras
ID: 2571494
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...
0
 

Author Comment

by:chrishui
ID: 2574054
Edited text of question.
0
 

Author Comment

by:chrishui
ID: 2574071
Hi, I have add some comments to my question. I hope that will help you to understand by preblem.
Thanks alot.
0
 
LVL 4

Accepted Solution

by:
inpras earned 100 total points
ID: 2575204
Hi
U have to format UR excel sheet before reading data from it U have to set a range by going ti INsert menu and choosing Name.
did U set the range for UR data in the excel sheet?
if not set it ODBC requires that a range should be set I think that is the problem UR facing.
U have demo project for reading data from excel here U will come to know what mistake UR doing here

http://www.codeguru.com/mfc_database/18-15-1.shtml
Hope this helps
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Expand to include initial dialog with two choices. 9 67
no14 challenge 14 62
modThree challenge 4 79
Annoying "thing" blocks my view 4 82
Introduction: Displaying information on the statusbar.   Continuing from the third article about sudoku.   Open the project in visual studio. Status bar – let’s display the timestamp there.  We need to get the timestamp from the document s…
Introduction: Hints for the grid button.  Nested classes, templated collections.  Squash that darned bug! Continuing from the sixth article about sudoku.   Open the project in visual studio. First we will finish with the SUD_SETVALUE messa…
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
This is used to tweak the memory usage for your computer, it is used for servers more so than workstations but just be careful editing registry settings as it may cause irreversible results. I hold no responsibility for anything you do to the regist…

910 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

27 Experts available now in Live!

Get 1:1 Help Now