Re: Insert asc(0) characters in strings
- From: "John Herbster" <herb-sci1_AT_sbcglobal.net>
- Date: Sun, 26 Mar 2006 08:52:53 -0600
"Mikael Lenfors" <mikael@xxxxxxxxxx> wrote
We have data strings containing all 256 ascii characters
(from 0-255). When I Try to insert them into the database
it fails.
I'm replacing ' characters with two ', this seems to work.
Mikael, What do you mean by "characters with two"?
The problem seems to be all characters with ascii value 0.
I am not surprised. You probably know that ASCII 0
(also known as #0) is used as a string terminator in
a lot of code.
How can I insert them? My insert looks like:
ADOQuery.SQL.Add(
'Insert Into RadarData (DataString) Values (' +
StringReplace(MyData,'''','''''',[rfReplaceAll]) + ')' );
DataString is declared as Text and
MyData can be 100K big!
First, I suggest breaking that statement into three statements,
so that you can see the contents of the intermediate strings.
s := StringReplace(MyData,'''','''''',[rfReplaceAll]);
s := 'Insert Into RadarData (DataString) Values (' + s + ')';
ADOQuery.SQL.Add(s);
I suspect that IDE's debugger may not properly show beyond
the #0 characters, so you could also check the value of
length(s);
Good luck hunting, JohnH
.
- Prev by Date: Re: Access violation error on domain only
- Next by Date: Re: CursorLocation -> Scrollbar behavior
- Previous by thread: Querying an ADODataSet
- Next by thread: Re: Insert asc(0) characters in strings
- Index(es):
Relevant Pages
|