错误
Enumeration
对于SqlDataReader
没有结果系统信息:::
到Microsoft Visual Studio Enterprise 2015版本14.0.25123.0 D14REL Microsoft .NET Framework版本4.7.03062
安装的版本:Enterprise SQL Server数据工具14.0.50616.0 Microsoft SQL Server数据工具
string connString =
"Data Source=.;" +
"Initial Catalog=library;" +
"User id=book;" +
"Password=sa;";
// conn.Open();
using (SqlConnection c = new SqlConnection(connString))
{
sql = @"SELECT * FROM kala";
// conn.Close();
SqlCommand cn = new SqlCommand(sql, c);
c.Open();
SqlDataReader dr = cn.ExecuteReader();
if (dr.HasRows)
{
while (dr.Read())
{
//empID = dr.GetInt32(0);
//empCode = dr.GetString(1);
//empFirstName = dr.GetString(2);
//empLastName = dr.GetString(3);
//locationCode = dr.GetString(4);
//locationDescr = dr.GetString(5);
//display retrieved record
//Console.WriteLine("{0},{1},{2},{3},{4},{5}", empID.ToString(), empCode, empFirstName, empLastName, locationCode, locationDescr);
}
}
}