A
Alex Ayzin
Hi,
I have a column in my WinGrid, that's being populated with numeric data, but
it's of String datatype(business rule requires to have these numbers as
varchars in DB). On top of that, I need to be able to sort on that
particular column. But because column contains character data(even though it
looks like digits), the sorting is all out of whack, e.g, 1, 11, 12,
13.....2, 21, 22, so on, you got the picture.I'm using the typed dataset as
a datasource for the grid, so I changed the column's datatype in the
datasource to Int32. Additionaly, I cast the column when I retrieve it in
Proc.(SELECT CONVERT(INT,ColumnName....). But it doesn't work, I mean it's
getting sorted in exactly the same way it did before.
I also tried to explicitly cast it before setting the grid's datasource:
For iRow = 0 To dsTyped.Tables("TableName").Rows.Count - 1
If Not dsTyped.Tables("TableName").Rows(iRow)(ColumnName) Is
GetType(System.Int32) ThendsTyped.Tables("TableName").Rows(iRow)(ColumnName)
= CType(dsTyped.Tables("TableName").Rows(iRow)(ColumnName), System.Int32)
End If
Next
Please advise or tell me what I'm doing wrong.
Thanks, Alex Ayzin
I have a column in my WinGrid, that's being populated with numeric data, but
it's of String datatype(business rule requires to have these numbers as
varchars in DB). On top of that, I need to be able to sort on that
particular column. But because column contains character data(even though it
looks like digits), the sorting is all out of whack, e.g, 1, 11, 12,
13.....2, 21, 22, so on, you got the picture.I'm using the typed dataset as
a datasource for the grid, so I changed the column's datatype in the
datasource to Int32. Additionaly, I cast the column when I retrieve it in
Proc.(SELECT CONVERT(INT,ColumnName....). But it doesn't work, I mean it's
getting sorted in exactly the same way it did before.
I also tried to explicitly cast it before setting the grid's datasource:
For iRow = 0 To dsTyped.Tables("TableName").Rows.Count - 1
If Not dsTyped.Tables("TableName").Rows(iRow)(ColumnName) Is
GetType(System.Int32) ThendsTyped.Tables("TableName").Rows(iRow)(ColumnName)
= CType(dsTyped.Tables("TableName").Rows(iRow)(ColumnName), System.Int32)
End If
Next
Please advise or tell me what I'm doing wrong.
Thanks, Alex Ayzin