Access 分页查询
自己做的一个.net错误收集,收集整站的500错误,用的access数据库。数据过20000后,使用传统的SELECT TOP 10 * from TABLE WHERE ID NOT IN(SELECT TOP 10*10 * from TABLE)查询竟然要好几分钟,汗~~~~!
网上查到的一条语句还不错。
SELECT TOP 10 id,Message,CreateTime from errMessage where (id > (SELECT MAX(id) from (SELECT TOP 10 id from errMessage ORDER BY id ) AS T)) ORDER BY ID
根据最大的ID来查,必须要有一个自增长的标识列即可!
相关文档:
新建表:
create table [表名]
(
[自动编号字段] int IDENTITY (1,1) PRIMARY KEY ,
[字段1] nVarChar(50) default '默认值' null ,
[字段2] ntext null ,
[字段3] datetime,
[字段4] money null ,
[字段5] int default 0,
[字段6] Decimal (12,4) default 0,
[字段7] image null ,
)
删除表:
Drop table [表 ......
今天谈两个ASP运行时可能出现的与IIS有关的错误
-------------------------------------------------------------------
错误类型一:
Microsoft OLE DB Provider for ODBC Drivers (0x80004005)
[Microsoft][ODBC Microsoft Access Driver] 不能更新。数据库或对象为只读。
错误类型二:
Microsoft OLE DB Provider ......
下面这段C# 代码可以用来压缩和修复Access数据库,不管它是一个简单的".mdb"ACCESS数据库还是一个".mdw"网络共享数据库,这个过程和你在用MS Access应用程序中使用的"工具-数据库实用工具-压缩和修复"时执行的操作完全一样.实例代码使用了"迟绑定"(运行中在内存中建立COM对象),这样就不需要在工程中加入COM引用了,也不需要在P ......
using System;
using System.IO;
using System.Runtime.InteropServices;
using System.Threading;
using System.Windows.Forms;
using Microsoft.Win32;
using Access = Microsoft.Office.Interop.Access;
namespace ImageAccess
{
static class Program
{
......