摘要: 方法1:适用于 SQL Server 2000/2005SELECT TOP 页大小 *FROM table1WHERE id NOT IN ( SELECT TOP (页大小*(页数-1)) id FROM table1 ORDER BY id )ORDER BY id 方法2:适用于 SQL Server 2000/2005SELECT TOP 页大小 *FROM table1WHERE id > ( SELECT ISNULL(MAX(id),0) FROM ( SELECT TOP 页大小*(页数-1) id FROM table1 ORDER BY id ) A )ORDER 阅读全文
posted @ 2010-08-31 22:48 neve 阅读(226) 评论(0) 推荐(0) 编辑
摘要: 按常规的思路,我们会这样写 复制代码 代码如下:String searchName ="Sam"; String strSql = "select * FROM Table1 where Name like '%@Name%' "; SqlParameter[] parameters = { new SqlParameter("@Name", searchName) }; 但结果是查询不到结果,跟踪代码也没有发现错误,又不想用字符串拼接的方式(防止攻击)。于是跟踪了Sql的执行,发现问题在于Sql给参数自动添加了单引号 阅读全文
posted @ 2010-08-31 13:24 neve 阅读(552) 评论(0) 推荐(0) 编辑