sqldatareader 取值问题
String sn = "SELECT TOP (1) SN FROM ES_News ORDER BY SN DESC ";
SqlCommand sqlcmd = new SqlCommand(sn, conn);
SqlDataReader ss = cmd.ExecuteReader();
if (ss.Read())
{
String a =ss["SN"].ToString();
Response.Write(a);
}
为什么不输出a的值? 是取值有问题么 本人初学,麻烦给解释下..
------解决方案--------------------SqlDataReader ss = sqlcmd.ExecuteReader();