Skip to main content
Participant
September 20, 2006
Answered

Error outputing records from Foxpro

  • September 20, 2006
  • 2 replies
  • 634 views
I ran into this error "ByteArray Objects cannot be converted to strings" when I tried to output values from one column in a Visual Foxpro table. The cfquery ran ok. Here is my overall situation.

Coldfusion server standard version 7.0.2
ODBC Datasource is Microsoft Visual Foxpro Driver version version 6.01.8629.01
Sql command is
SELECT COCDCL
FROM COE3002
WHERE CONOM = 'ELECTRICITY'

COCDCL is Visual Foxpro column of data type character of 12 (size)

It looks to me that if the character field size is 10 or less it will work. Is this a problem with Microsoft ODBC driver for Visual Foxpro? What can I do to get around this problem?
This topic has been closed for replies.
Correct answer paross1
According to MSDN you probably need to provide a precision for this datatype.

CAST(eExpression AS cDataType [(nFieldWidth [, nPrecision])] [NULL | NOT NULL])

Phil

2 replies

tranktAuthor
Participant
September 21, 2006
I tried using SQL CAST as suggested and although I am fairly sure that CAST is a legitimate SQL function this is the error I got.

Error Executing Database Query.
[Macromedia][SequeLink JDBC Driver][ODBC Socket][Microsoft][ODBC Visual FoxPro Driver]Function name is missing ).
paross1Correct answer
Participating Frequently
September 21, 2006
According to MSDN you probably need to provide a precision for this datatype.

CAST(eExpression AS cDataType [(nFieldWidth [, nPrecision])] [NULL | NOT NULL])

Phil
Participating Frequently
September 20, 2006
This is just a SWAG, but you may want to try and CAST() this column as type VARCHAR.

SELECT CAST(COCDCL AS VARCHAR) AS COCDCL_new
FROM COE3002
WHERE CONOM = 'ELECTRICITY'

Phil