Windows 2008 IIS access访问数据库报错
故障现象:
Windows 2008 64位系统,asp网页访问access数据库报如下错误.
相关代码
set conn=server.CreateObject("adodb.connection")
set rs=server.CreateObject("adodb.recordset")
connstr="provider=microsoft.jet.oledb.4.0;data source="&server.mappath("db/db.mdb")
conn.open connstr
sql="select * from sort where sort_id=1"
rs.open sql,conn,3,3
或者提示 500 错误
解决方法:
问题出在64位数据库连接驱动上,修改”启用32位应用程序”为True即可解决问题.
打开IIS,打开应用程序池,找到对应网站的名字,选择"高级设置"
原贴内容:
http://www.duxt.net/article.asp?id=36
相关文档:
新建表:
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 [表 ......
一、创建一张空表:
Sql="Create TABLE [表名]"
二、创建一张有字段的表:
Sql="Create TABLE [表名]([字段名1] MEMO NOT NULL, [字段名2] MEMO, [字段名3] COUNTER NOT NULL, [字段名4] DATETIME, [字段名5] TEXT(200), [字段名6] TEXT(200))
字段类型:
2 : "SmallInt", // 整型
3 : "Int", ......
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
{
......
抛弃MS Access吧,请使用SQLite
1、SQLite简介
SQLite第一个Alpha版本诞生于2000年5月. 至今已经有4个年头了. 而在今年的5月SQLite也迎来了一个新的里程: SQLite 3. SQLite官方网站: http://www.sqlite.org/
2、SQLite类型
SQLite的数据类型
首先你会接触到一个让你惊讶的名词: Typelessness(无类型). 对! SQLite是无 ......
1:在StaAfx.h 中添加如下代码 #import "C:\\Program Files\\Common Files \\System\\ado\\msado15.dll" no_namespace rename("EOF","adoEOF")rename("BOF","adoBOF")
2:在BOOL CXXXApp::InitInstance()中初始化COM环境
::CoInitialize(NULL);
释放COM环境
::CoUninitialize();
......