Hi Danny,
You've got your string formats different for your SQL and your .NET which results in comparing apples with oranges.
You've got your SQL:
- Code: Select all
FieldName = "CONVERT(varchar(20),RE_Main.SlipDate,20)+RE_Main.SlipNo"
Which sees data like this returned:
- Code: Select all
2011-07-31 00:00:0032131
But then you've provided some different formatting for the .NET delegate SortFieldValueMethod:
- Code: Select all
SortFieldValueMethod = delegate() {return GRN.SlipDate.ToString("yyyyMMddhhmmss") + GRN.GRNNo; }
Which returns:
- Code: Select all
2011073100000032131
Which are going to cause you issues, as your formats are no longer the same. String comparisons are quite literal - those hyphens, colons and spaces included as a result of your SQL Convert using a format specifier mean your .NET string formatter which didn't include hyphens, colons or spaces is going to cause a mismatch.
Using your code, I found the following to work for me in demo data:
- Code: Select all
SortFieldValueMethod = delegate() {return GRN.SlipDate.ToString("yyyy-MM-dd hh:mm:ss") + GRN.GRNNo; }
Try that and see how it works for you.
Running a SQL Profiler trace and seeing what query Jiwa issues with your plugin is a good way to identify such issues - it should make it fairly obvious why it wasn't working as you expected.
Mike