我有下面的C#代码
cmd = new SqlCommand("SELECT TOP 1 * FROM "+label7.Text+" ORDER BY searches DESC ", con);
var columnSize = cmd.ExecuteScalar();
int plithos = int.Parse(string.Format("{0}", columnSize));其中con是我的连接字符串。我所要做的就是在plithos中输入列searches的最后一个值。列searches有超过17条记录,但出于某种原因,plithos获得了列搜索的第九条记录,这部分代码不应该取上一条记录的值?我正在构建的应用程序是Visual中的表单应用程序。请帮帮我,这太令人沮丧了
下面是列searches
Searches| 1 2 3 4 5 6 7 8 9-> value of plithos . . . 19
发布于 2016-11-04 18:33:42
感谢PaulAbbott,答案是以下命令:
cmd = new SqlCommand(SELECT TOP 1 searches FROM "+label7.Text+" ORDER BY cast(searches as int) DESC
https://stackoverflow.com/questions/40429281
复制相似问题