dOOdads 连接 ACCESS 的数据分页问题
如题 dOOdads 连接 ACCESS 的数据分页问题!
使用 dOOdads 连接 ACCESS数据的时候 数据分页的问题!
根据这个改吧
C# code:
public static Product[] SearchProducts(string keyword, int categoryID, int pageSize, int pageIndex, out int total)
{
OleDbConnection connection = new OleDbConnection(ConnectionString);
// 建立查询,查出满足条件产品的总数
OleDbCommand countCommand = connection.CreateCommand();
countCommand.CommandText = "SELECT COUNT(ProductID) from tblProducts ";
string where = "WHERE Active > 0 ";
if (categoryID > 0)
{
where = where + "AND CategoryID = " + categoryID.ToString() + " ";
}
if (!string.IsNullOrEmpty(keyword))
{
where = where + "AND ProductName LIKE '%" + keyword + "%' ";
}
countCommand.CommandText += where;
DataTable dt = new DataTable();
try
{
connection.Open();
total = (int)countCommand.ExecuteScalar();
if (total < 1) return null; // 没有记录返回空(null)
int maxPageNum = (total % pageSize == 0 ? total / pageSize : total / pageSize + 1);
相关问答:
ACCESS数据库中有一个tablename表,设计如下
编号,书名,作者,出版时间,出版社,ISBN,目录,简介
其中除“编号”为自动编号外,其它都为“备注”
其中"编号"维一,在“ISBN”中有的为空值, ......
Dbgrid连接access 显示数据时拖动滚动条死机?怎么解决啊?
机器太差了吧?
是不是你数据量太大了啊
你数据少一些看看还死机吗?
数据很少啊 就一页。
我在BCB6下做过不少 DBGRID+ACCESS ,从来没有遇到 ......
最近学习asp,当练习到连接数据库的时候,频频出错,可就是不知道错在怎么地方,请高手帮忙看看!!谢谢!
包含文件xx.asp、xxsave.asp、conn.asp以及student1.mdb和表xxgl……
xx.asp为:
<html>
<hea ......
我做了一个小程序,想实现的功能就是在文本框中输入姓名,点击查询按钮,就能查到ACCESS数据库中此学生的信息(编号,姓名,性别,年龄)可我不知道语法格式,我自己写的语句调试能通过,可是运行时出错(点击查询按 ......