Iβm not sure if this is the right way, but I wanted to use what Iβm comfortable with. If you use the entity framework and load it, you can put String.Format in the LINQ query.
Dim ds as Entity = New Entity() ds.FinancialInstitutionTransactions.OrderByDescending(Function(c) c.TransID).Load() Dim openLoad = From tr In ds.FinancialInstitutionTransactions.Local Select TransDate = String.Format("{0:d}", tr.Date), tr.Number, tr.ToFrom, Debit = If(tr.Debit = 0, " ".ToString(), String.Format("{0:N}", tr.Debit).ToString()), Credit = If(tr.Credit = 0, " ".ToString(), String.Format("{0:N}", tr.Credit).ToString())
You need to reference System.Data.Entity to download, but then it's easy to format the results the way you want.
Hope this helps someone. I know this is in vb.net, but it would not be difficult to convert to C #.
source share