String.Replace bug - repost

  • Thread starter Thread starter Jon Gross
  • Start date Start date
J

Jon Gross

I apologize in advance for this repost. It was done using MSDN
subscriber credentials to attract Microsoft's attention.

When using the String.Replace() method I'm encountering differing
behavior on a Dell AXIM running WinCE 2003 and a Compaq iPAQ 3950
running WinCE 2002.

The following code snippet is representative of the process in
question
'### begin code excerpt
Const TABLE_NAME As String = "%tableName%"

Dim insertCommand As String = _
"INSERT into " & TABLE_NAME & " (" & _
"Value_Id," & _
"Value_Modified_UTC_DateTime" & _
") " & _
"VALUES (" & _
Id.ToString & "," & _
"'" & Format(Date.UtcNow, cAITDateTime.SQL_DATE_FORMAT) & _
")"

Dim cmd as new SqlServerCe.SqlCeCommand()
cmd.CommandText = insertCommand.Replace(TABLE_NAME, "pdaValue")
'### end code excerpt

On the iPAQ the CommandText property ends up with a
value="INSERT into pdaValue (..."
On the AXIM the CommandText property ends up with a
value="INSERT intopdaValue% (..."

Note the 'off by one' bug. Strangely enough, this same test works
fine on both platforms if the constant is initialized with this value:
"_tableName_".

Obviously I've already found a work-around. Just use a different
'placeholder' string within the larger string. Any thoughts on why
this is happening? Is it 2002 vs. 2003? Compaq vs. Dell? Both
devices have exactly the same CF and other software installed?

Thanks in advance,
Jon
 
Microsoft has confirmed that this IS A BUG in the Compact Framework
version 1.0 Service Pack 1 when running on a Dell Axim using Windows
CE 2003.

They have also tested on that same platform using an upcoming release
of the CF (presumably SP 2) and found it to no longer be a problem.

Michael
 
Back
Top