DapperLib / DapperLib/Dapper

System.Data.DataException:“Error parsing column 6 (Amount=0.01 - Double)”

Open
#1,002 6 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
C#
Stars
18.4k
Forks
3.7k
Avg merge
5h 8m
Merged PRs (30d)
1

Description

i using dapper with sqlite
i have a model UPFlow
public class UPFlow
{
public string Id { get; set; }
public string PartnerId { get; set; }
public string TradeNo { get; set; }
public string RefundTradeNo { get; set; }
public int Service { get; set; }
public int PayWay { get; set; }
public decimal Amount { get; set; } // DECIMAL(10, 2)
public string IPAddress { get; set; }
public DateTime Time { get; set; }
}

when i read this table in .net core 2.X, i get a exception :
System.Data.DataException:“Error parsing column 6 (Amount=0.01 - Double)”
InvalidCastException: Unable to cast object of type 'System.Double' to type 'System.Int64'.

bu i read this table in .net framework 4.X, it's nothing excption.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the reported Amount mapping with the UPFlow model and SQLite under .NET Core 2.x, then compare the result with .NET Framework 4.x. Confirm the failure and identify the expected decimal conversion behavior before defining a regression test; the issue is resolved when the same row materializes without the reported DataException.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp, sqlite
Domain
backend, database
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.