简体   繁体   中英

Dapper incorrectly thinking Column Numeric

I have been using dapper for a while but have come across a strange issue.

I have a Column in a database table called , in my query my Table

my dapper query is

SELECT p.Id PaymentId, p.AmountPaid PaymentAmountPaid, np.NoticeNo PaymentRef

In the Database the column NoticeNo is defined as nchar

When I query it, its mapped to class with the following property

public string PaymentRef { get; set; }

I query as follows connection.Query<PaymentSummary>(sqlStr)

but very strange, dapper seems to think that the NoticeNo column is a number, so if the store notice no as 1234 then when its queried the result is 1234.00

Most of the notice numbers are numeric, but they don't have to be.

Any ideas?

Thanks ash.

Turns out it wasn't Dapper's Fault. The query was part of a union, and I had the notice no and the amount column in a different order in two if the queries, which was forcing the result to be a Number!!

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM