SQL语句失败
本文关键字:失败 语句 SQL | 更新日期: 2023-09-27 18:01:13
我使用以下语句:
SELECT ThreadsID
FROM Threads
ORDER BY ThreadsID DESC
为什么sql语句不能返回我期望的结果?出于某种原因,它将一条带有id = 32
的记录放在id = 52
和id = 53
之间:
threadid
---------
...
53
32 -- <-- huh?!
52
连接字符串:
<add name="modelConnectionString" connectionString="Data Source=.'SQLEXPRESS;AttachDbFilename='D:'Documents and Settings'Dima'My Documents'Visual Studio 2010'WebSites'WebSite10'App_Data'ASPNETDB.MDF';Integrated Security=True;User Instance=True;Trusted_Connection=Yes;"
providerName="System.Data.SqlClient" /
我得到了影响列表的其他信息:
StringBuilder sb = new StringBuilder();
sb.Append("SELECT u.Name,t.ThreadTitle,t.Date, t.Views,t.Replies,p.Theme,p.Topics,t.PageNumber, t.ThreadsID");
sb.Append(" FROM Threads AS t");
sb.Append( " INNER JOIN Users AS u ON u.UsersID=t.UsersID");
sb.Append( " INNER JOIN Topics AS p ON p.TopicsID=t.TopicsID");
sb.Append(" WHERE t.ThreadsID=@ThreadsID");
@ThreadsID。。转到第二个查询。。。但是它不会影响事情的顺序。。在执行了这两个单独的sql命令后,我得到了一个奇怪的结果,即我得到了