关于分页查询语句的问题......
我是刚学Access,不足之处,请各位大虾指教!!!
public DataSet getPagedInfo(string tbName, int index, int count, out int rowCount)
{
string sql = "select top " + count + " * from " + tbName + " where [ID] not in (select top " + index * count + " [ID] from " + tbName + ")";
OleDbConnection mconCurrent = GetConn();
DataSet ds = new DataSet();
mconCurrent.Open();
int res = 0;
rowCount = getInfoCount(tbName);//这里可以拿到查询表的总记录数
try
{
OleDbDataAdapter oleDt = new OleDbDataAdapter(sql, mconCurrent);
oleDt.Fill(ds);
return ds;
}
finally { closeConn(mconCurrent); }
}
程序运行传入的参数 (JobInfo,0,4,out rCount) 生成语句select top 4 * from JobInfo where [ID] not in (select top 0 [ID] from JobInfo);在运行到oleDt.Fill(ds);这句时程序报错:【System.Data.OleDb.OleDbException: 语法错误。 在查询表达式 '[ID] not in (select top 0 [ID] from JobInfo)' 中】,但是我在sql server里面可以运行这个语句,这到底是什么原因???