Data Type Error Argument 6 FWriteline

68 views
Skip to first unread message

jrol...@gmail.com

unread,
Dec 24, 2021, 6:06:50 PM12/24/21
to
Hi I'm getting a "Function: _GET_LONG" error (Type String, requested type LONGINT)

What am I missing please? Heres the code involved:

For i := 1 to oDb:Fcount
AAdd(aRay, {oDb:FieldInfo(DBS_NAME, i), oDb:FieldInfo(DBS_TYPE, i), oDb:FieldInfo(DBS_LEN, i), oDb:FieldInfo(DBS_DEC, i)})
FWriteLine(ptrHandle, "AAdd(aDBF,{ " + '"' + AllTrim(oDb:FieldInfo(DBS_NAME, i)) + '", ' + '"' + AllTrim(oDb:FieldInfo(DBS_TYPE, i)) + '", ' + AllTrim(Str(oDb:FieldInfo(DBS_LEN, i))) + ', ' , AllTrim(Str(oDb:FieldInfo(DBS_DEC, i))))
? "AAdd(aDBF,{ " + '"' + AllTrim(oDb:FieldInfo(DBS_NAME, i)) + '", ' + '"' + AllTrim(oDb:FieldInfo(DBS_TYPE, i)) + '", ' + AllTrim(Str(oDb:FieldInfo(DBS_LEN, i))) + ', ' , AllTrim(Str(oDb:FieldInfo(DBS_DEC, i)))
Next

This line of code gives the error,

FWriteLine(ptrHandle, "AAdd(aDBF,{ " + '"' + AllTrim(oDb:FieldInfo(DBS_NAME, i)) + '", ' + '"' + AllTrim(oDb:FieldInfo(DBS_TYPE, i)) + '", ' + AllTrim(Str(oDb:FieldInfo(DBS_LEN, i))) + ', ' , AllTrim(Str(oDb:FieldInfo(DBS_DEC, i))))


While this line does not and works fine
? "AAdd(aDBF,{ " + '"' + AllTrim(oDb:FieldInfo(DBS_NAME, i)) + '", ' + '"' + AllTrim(oDb:FieldInfo(DBS_TYPE, i)) + '", ' + AllTrim(Str(oDb:FieldInfo(DBS_LEN, i))) + ', ' , AllTrim(Str(oDb:FieldInfo(DBS_DEC, i)))


What am I missing please?

D.J.W. van Kooten

unread,
Dec 24, 2021, 7:44:55 PM12/24/21
to
Replying on message of Fri, 24 Dec 2021 15:06:49 -0800 (PST) from
jrol...@gmail.com:


Hello jrol...@gmail.com

>What am I missing please?


Not an obvious one. I would first assign the line to a string variable
and then see if FWriteLine(ptrHandle,cString) works. If not, replace
the string with something simple.

FWriteLine is not strong typed and you do not need to supply nCount as
this will then take the length of the string. So a longint requested
error doesn't directly make sense.

Maybe something is wrong with the string due to the construction with
single and double quots and this should become clear by assigning to a
string variable (and then add to it part by part)

Dick

jrol...@gmail.com

unread,
Dec 26, 2021, 8:30:32 PM12/26/21
to
Thank you very much Dick, you were correct, assigning the string to a variable solved it. Thank you again

Steve

unread,
Dec 27, 2021, 5:08:08 AM12/27/21
to
It's the last part of the line that is wrong, + ', ' , AllTrim(Str(oDb:FieldInfo(DBS_DEC, i))). I think the final , (comma) should be a + (plus sign), or the final ' (apostrophy) should be at the end of the line. If you break the line down you will see what I mean
Reply all
Reply to author
Forward
0 new messages