积极答复者
DNX连接数据库 SqlDataReader 未包含 "Close" 的定义

问题
-
string connectionString = "Server=.; Database=Test; User ID=sa; Password=123";
using (var connection = new SqlConnection(connectionString))
{
using (var command = connection.CreateCommand())
{
command.CommandText = "SELECT * FROM [Table]";
connection.Open();
var reader = command.ExecuteReader();
while (reader.Read())
{
for (int i = 0; i < reader.FieldCount; i++)
{
var name = reader.GetName(i);
Console.WriteLine("{0}\t\t{1}", name, reader[i]);
}
Console.WriteLine();
}
reader.Close();
connection.Close();
}
}SqlDataReader 未包含 "Close" 的定义
答案
-
你好,
关于vnext我建议你发到asp.net英文论坛。 http://forums.asp.net/1255.aspx/1?ASP+NET+vNext
We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
Click HERE to participate the survey.- 已标记为答案 CaillenModerator 2016年4月13日 9:50
全部回复
-
你好,
根据你的描述,是在编译的时候报 “SqlDataReader未包含Close的定义” 吗? 我用你的代码在本地建了一个project并编译,没有出现类似的错误。我的测试截图如下。
简而言之,我无法重现你的问题,你能提供更多详细的描述吗?
We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
Click HERE to participate the survey. -
你好,
关于vnext我建议你发到asp.net英文论坛。 http://forums.asp.net/1255.aspx/1?ASP+NET+vNext
We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
Click HERE to participate the survey.- 已标记为答案 CaillenModerator 2016年4月13日 9:50