日期:2014-05-16 浏览次数:21209 次
//根据warnime的最大值来取值
myCommand.CommandText = "SELECT * FROM warnTable WHERE warntime=(SELECT MAX(warntime) FROM warnTable )";
//myCommand.CommandText = "SELECT value, MAX(warntime) FROM warnTable WHERE NAME = '" + name + "' group by value";
//myCommand.CommandText = "SELECT top 1 value FROM warnTable WHERE NAME = '" + name + "' ORDER BY warntime desc";
//判断是否查找成功
MySqlDataReader getValue = myCommand.ExecuteReader();
if (getValue.Read())
{
dataValue = Convert.ToInt32(getValue["value"].ToString().Trim());
}