title: System.InvalidOperationException. Conversion failed because the Decimal data value overflowed the type specified
body: <p>I have a query that runs without problems in ms access, but when I run the query from c# winform application it shows the following error:
  System.InvalidOperationException: Conversion failed because the Decimal data value overflowed the type specified for the Decimal value part in the consumer's buffer. also one column 'total' appears correct in ms access query results but it shows a different result in C# datagridview. 
  See the query:</p>
  
  <pre><code>SELECT B.Serial, B.payId, B.invoiceId, B.subTotal, B.discount AS disPercent, (B.subTotal*(discount/100)) AS disAmount, B.total, FORMAT(B.payDate,'dd/MMM/yyyy  hh:mm AM/PM') AS payDate, 
  B.amount, B.sumPayments, B.balance, B.remark, 1 AS prevRecord
  FROM (SELECT (select  IIF( IsNull( count(*)),'',count(*) ) from payment where A.invoiceId = invoiceId and A.payId&gt;=payid) AS Serial, 
  A.payId, 
  A.invoiceId, 
  (select IIF( IsNull(sum(unitPrice*quantity)),0.0,sum(unitPrice*quantity)) from invoiceDetails where A.invoiceId=invoiceDetails.invoiceId) AS subTotal, 
  ( select discount from invoice where invoice.invoiceId = A.invoiceId ) AS discount, 
  (select total from invoice where A.invoiceId=invoice.invoiceId) AS total, 
  A.payDate, A.amount, 
  (select  IIf(IsNull(sum(amount)), 0.0, sum(amount))  from payment where A.invoiceId = payment.invoiceId and payment.payId&lt;=A.payId )  as sumPayments,
  ((select  total from invoice where A.invoiceId=invoice.invoiceId)-(select  IIf(IsNull(sum(amount)), 0.0, sum(amount))  from payment where A.invoiceId = payment.invoiceId and payment.payId&lt;=A.payId )) AS balance, 
  A.remark FROM payment AS A
  Where A.invoiceId=14
  )  AS B;
  </code></pre>
  
  <p>leading to the following results:</p>
  
  <p><a href="https://i.stack.imgur.com/Wlhiu.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/Wlhiu.jpg" alt="enter image description here"></a></p>
  
  <p>In C# winForm there are two cases, the first is the following error:</p>
  
  <p><a href="https://i.stack.imgur.com/RIpfp.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/RIpfp.jpg" alt="enter image description here"></a></p>
  
  <p>Or the results will appear different from the results in ms access:</p>
  
  <p><a href="https://i.stack.imgur.com/SZ48D.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/SZ48D.jpg" alt="enter image description here"></a></p>
  
  <p>I dont know why thats happening. 
  Please some help</p>