[英]Dapper is throwing System.Data.SqlClient.SqlConnection exception after upgrading System.Data.SqlClient to version 4.5.0-preview2
[英]System.Data.SqlClient.SqlConnection does not contain a definition for Query with dapper and c#
編譯時的以下代碼給出了以下錯誤消息:
'System.Data.SqlClient.SqlConnection'不包含'Query'的定義,並且沒有擴展方法'Query'接受類型為'System.Data.SqlClient.SqlConnection'的第一個參數'(你是否缺少using指令)或匯編參考?)
我使用nuget包裝器添加了Dapper。
有任何想法嗎? 謝謝,
碼:
using (SqlConnection sqlConnection = new SqlConnection(Connectionstring))
{
sqlConnection.Open();
Member customer = sqlConnection.Query<Member>("SELECT * FROM member");
return customer;
}
您需要在.cs文件中放置using語句,以使Dapper擴展方法可用。
using ...;
using Dapper;
using ...;
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.