DataColumn.Expression delimiter problem.

  • Thread starter Thread starter Jason
  • Start date Start date
J

Jason

First off, I tried to find an ADO.NET forum, or even just
a .NET framework forum but couldn't seem to locate one and
I apologize in advance if I've posted in the wrong place.

Because I'm using a dataset in VB.NET I figured this was
the next logical place to ask my question.

I'm using the DataColumn.Expression property, and when I
call the function with a '\' I get a crash.

Here is my code:

For Each columnToSum In columnsWithSumsList
Dim expression As String
expression = "SUM([" & CStr(columnToSum) & "])"
expression = expression.Replace("\", "[\]")
'do the actual sum computation
Dim sum As Object = detailsTable.Compute(expression,
filter)

If Not IsDBNull(sum) Then
newRow(columnToSum) = CDbl(sum)
End If
Next

Basically when I send in the columnToSum = '\' I then
change it to SUM([\]) (square brackets handle the
sensitive characters. But I get problems because the [\]
actually equals "[]"

I'm not sure of what string modification i need to make to
my expression that allows it to be save when users input a
forward slash. If anyone has any ideas I'd sure
appreciate it!

Thanks in advance!
 
Hi Jason,

This is not an ADO.NET forum question.

If you are lucky Jay B. sees your subject and helps you if he has time for
that.

But don't pay attention to messages that redirects you to other groups.

If this is no VB.language than a regular Expression is also no VB.language,
it is quiet the same.

I don't use it, as I don't use the regular Expression, so if I would help
you it would be the blind who helps the deaf.

But hopefully Jay B has some time for you.

Cor
 
Back
Top