Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 334
  • Last Modified:

C++ - how to use ODBC text driver ?

I want to use the ODBC text driver from out VC++ 5. Where can I find any documentation about this or how to do it ? I have full knowledge of the use of other ODBC drivers so my problem is related only to the textdriver !
0
Gregory_seifert
Asked:
Gregory_seifert
1 Solution
 
tommyqCommented:
Gregory,
So you want to write code that accesses a text table from VC 5?
0
 
Gregory_seifertAuthor Commented:
It will be clear that my question doesn't mean I don't know how to access text files fromout Visual C++.

The problem is I want to use the Cristal Reports tools fromout visual C++ to generate reports from text files. Normally generating full printable documents in Visual C++ is a time consuming task. However if I know how to use the ODBC textdriver I can pass through this task towards Cristal reports. I already know you have to use the ODBC administrator (or directly and updating the registry) to create a params.INI file. However I don't succeed to access files through the CRecordSet class. When calling CRecordSet::Open I receive a messagebox with "error in FROM clause"
0
 
msa092298Commented:
The problem is how the ODBC text driver interprets the file. I faced the same problem.
The first (and only the first) line of the file is considered to be a comma separated list of field names.  The remaining lines are considered to be comma separated list of data values. If the number of values in any one line exceeds the number of field names at the first line, the driver generates field names like field1, field2 ...  You should choose field names in the first line that cause no problems for crystal reports (no space characters, etc..).
ex. for a text file

<file starts here>ID,Name,Address
1,my name,my address
2,your name,your address
3,his name,his address.<file ends here>
0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now