I am developing a CR in VB and am having some problems accessing a table (in txt file format) where one of the column contain both numbers and string. See sample txt file below.
Sample txt file.txt
===================
Description, value
Item1, 123
Item2, 456
Item3, Text Description
The CR report I am designing is using unbound fields and both fields (Description and value) are string data type. The SQL query is "select * from file.txt".
When CR tries to access the table, it reported "Seagate Crystal Report: Database errors" with no message. When I clicked OK, the following message appears "Run-time error '-2147192185 (80047287)': SQL server error'. After some investigation, I came to the conclusion when CR is access the data, CR treated the first two as numbers and when reading the third line, found a mismatch and hence the error.
However, if I converted the file to the following, my CR report works like a charm.
Modified txt file.txt
=====================
Description, value
Item1, "123"
Item2, "456"
Item3, "Text Description"
I am trying to avoid adding the quotes in, can anyone provide some guidance how I can modify the query or CR?
PS: I have the totext function and it did not work.
Sample txt file.txt
===================
Description, value
Item1, 123
Item2, 456
Item3, Text Description
The CR report I am designing is using unbound fields and both fields (Description and value) are string data type. The SQL query is "select * from file.txt".
When CR tries to access the table, it reported "Seagate Crystal Report: Database errors" with no message. When I clicked OK, the following message appears "Run-time error '-2147192185 (80047287)': SQL server error'. After some investigation, I came to the conclusion when CR is access the data, CR treated the first two as numbers and when reading the third line, found a mismatch and hence the error.
However, if I converted the file to the following, my CR report works like a charm.
Modified txt file.txt
=====================
Description, value
Item1, "123"
Item2, "456"
Item3, "Text Description"
I am trying to avoid adding the quotes in, can anyone provide some guidance how I can modify the query or CR?
PS: I have the totext function and it did not work.