分页填充:int currentIndex = 0; int pageSize = 5;string orderSQL = "SELECT * FROM Orders ORDER BY OrderID"; SqlDataAdapter myDA = new SqlDataAdapter(orderSQL, nwindConn);DataSet myDS = new DataSet(); myDA.Fill(myDS, currentIndex, pageSize, "Orders"); 但是这样会把数据全部提出来,但是只填充前5条若要用相同的 5 个记录填充 DataSet 但仅返回这 5 个记录,请在 SQL 语句中使用 TOP 和 WHERE 语句, int pageSize = 5;string orderSQL = "SELECT TOP " + pageSize + " * FROM Orders ORDER BY OrderID"; SqlDataAdapter myDA = new SqlDataAdapter(orderSQL, nwindConn);DataSet myDS = new DataSet(); myDA.Fill(myDS, "Orders");你可以参考帮助里的查询分页的例子
这样才好进行 between
生成xml文件..
int pageSize = 5;string orderSQL = "SELECT * FROM Orders ORDER BY OrderID";
SqlDataAdapter myDA = new SqlDataAdapter(orderSQL, nwindConn);DataSet myDS = new DataSet();
myDA.Fill(myDS, currentIndex, pageSize, "Orders");
但是这样会把数据全部提出来,但是只填充前5条若要用相同的 5 个记录填充 DataSet 但仅返回这 5 个记录,请在 SQL 语句中使用 TOP 和 WHERE 语句,
int pageSize = 5;string orderSQL = "SELECT TOP " + pageSize + " * FROM Orders ORDER BY OrderID";
SqlDataAdapter myDA = new SqlDataAdapter(orderSQL, nwindConn);DataSet myDS = new DataSet();
myDA.Fill(myDS, "Orders");你可以参考帮助里的查询分页的例子