B4J Question TextField.Text vs String

a n g l o

Active Member
Licensed User
Longtime User
windows.
my code reads from a text file created by other app (other language) of mine a network path in the format : "\\PCNAME\SharedFolderName".
the code stores this path in sqlite db text field, using Update-Set sql statement and SQL.ExecNonQuery.
2 different behaviors in the sql statement :
1. .....Set fldPath='" & string_that_read_from_the_text_file & "';" ''CRASH
2. .....Set fldPath='" & TextField.Text_that_read_from_the_text_file & "';" ''OK

both the string and the TextField.Text logs exactly the same in the IDE.
that means that the problem is in the meeting of the backslashes with the db engine or with the sql lib.
seems that the TextFiled.Text is coming better prepared to that meeting...(more reliable (for me))
 

DonManfred

Expert
Licensed User
Longtime User
Upload a small projekt showing the problem.

1. There is NO CRASH without any log
2. WHERE is the full error?
3. I can´t imagine/believe SQLite should have a problem with a varchar like \\PCNAME\SharedFolderName
 
Upvote 0

a n g l o

Active Member
Licensed User
Longtime User
windows.
my code reads from a text file created by other app (other language) of mine a network path in the format : "\\PCNAME\SharedFolderName".
the code stores this path in sqlite db text field, using Update-Set sql statement and SQL.ExecNonQuery.
2 different behaviors in the sql statement :
1. .....Set fldPath='" & string_that_read_from_the_text_file & "';" ''CRASH
2. .....Set fldPath='" & TextField.Text_that_read_from_the_text_file & "';" ''OK

both the string and the TextField.Text logs exactly the same in the IDE.
that means that the problem is in the meeting of the backslashes with the db engine or with the sql lib.
seems that the TextFiled.Text is coming better prepared to that meeting...(more reliable (for me))
update :
the issue is a hidden characters. text file may contain hidden characters. when reading a text file into STRING, the string contains the hidden characters BUT YOU DON'T SEE THEM IN THE IDE LOG ( as they are hidden...) so you think everything ok. when you use the string to access a path/file/whatever - CRASH .
that DOES NOT happen if you read the text file into TextField.Text ! it seems that a ui element ignores the hidden characters. so when using its Text property the path/file/whatever can be accessed safely with out crash.
of course, once i've nailed it, i'll handle it.... but the topic is correct : there is a diff between TextFiels.Text and a String variable.
 
Upvote 0
Top