Search code examples
c#sqldatabasesqlyog

How to sum() query in C# using sql yog


i am trying to get Sum() of value in my database data using C# but i am having an error Exception error sql type -0 here is my Code.

the problem is here when i am passing value through dr i am always getting exception error

enter image description here

ArgumentException has unhandled Unknown Sql type -0


Solution

  • If you can use linq,you can fix like this:

    label.Text=(from f in audittrail_tbl
                select f).Sum(S=>S.Income).ToString();