我正在尝试使用ExecuteReaderAsync()
异步查询数据库,但是我收到以下错误:
'System.Data.SqlClient.SqlCommand' does not contain a definition for
'ExecuteReaderAsync' and no extension method 'ExecuteReaderAsync' accepting a first
argument of type 'System.Data.SqlClient.SqlCommand' could be found (are you missing a
using directive or an assembly reference?)
我正在使用VSE 2012 for Windows Desktop,并且已经安装了.NET 4.5。我正在引用
C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.0\Profile\Client\System.Data.dll
我读过.NET 4.5只是替换4.0,但每当我尝试在4.5目录中选择System.Data.dll时,它都会引用4.0中的那个。不确定这是否重要。
答案 0 :(得分:5)
答案 1 :(得分:1)
选择项目属性并将Target框架设置为.NET Framework 4.5,而不是客户端配置文件。