[求助]网站数据库原来是SQL换成Access后数据无法写入

来源:百度知道 编辑:UC知道 时间:2020/02/25 20:42:48
我的网站数据库原来用的是SQL的,我把数据导出成Access的后,有把CONN文件内容改了下
结果注册用户时提示注册成功了但是没有写到数据库里,还有所有的信息都不能写到数据库里了,
是怎么回事?

没改前CONN文件内容:
<!--#include file="inc/md5.asp"-->
<!--#include file="inc/base64.asp"-->
<%
Session.Timeout=5
'if request("b_rules")=1 then
'Response.Buffer = True
'else
'Response.Buffer = True
'Response.ExpiresAbsolute = Now() - 1
'Response.Expires = 0
'Response.CacheControl = "no-cache"
'end if
sitetitle=" - cici"

dim conn
dim connstr
on error resume next

'连接数据库
'---------------------------------------------------------------------------
connServerName = "(local)" '数据库服务器名或者IP,本机填“(local)”即可。
connDatabase = "111" '数据库名称
connUserName = "sa" '数据库用户名
connPassword = "111111" '数据库密码
'---------------------------------------------------------------------------
Set conn = Server.CreateObject("ADODB.Connection")
connstr="Provider=SQLOLEDB;Data Source="&connServerName&";Initial Catalog="&connDatabase&";User ID="&connUserName&";Password="&connPassword&";"

if err.number<>0 then
err.clear
set conn=nothing
response.write "数据库连接错误,请检查"
Response.End
else
conn.open connstr
if err then
err.clear
set conn=nothing
response.write "数据库连接错误,请检查"
Response.End
end if
end if

sub endConnection()
conn.close
set conn=nothing
end sub
%>

改后的MONN内容:
<!--#include file="inc/md5.asp"-->
<!--#include file="inc/base64.asp"-->
<%
Session.Timeout=5
'if request("b_rules")=1 then
'Response.Buffer = True
'else
'Response.Buffer = True
'Response.ExpiresAbsolute = Now() - 1
'Response.Expires = 0
'Response.CacheControl = "no-cache"
'end if
sitetitle=" - cici"

dim conn
dim connstr
on error resume next

Set conn = Server.CreateObject("ADODB.Connection")
connstr="Provider=Microsoft.Jet.OLEDB.4.0;Data Source="+server.mappath("admin/DB/11.mdb")

if err.number<>0 then
err.clear
set conn=nothing
response.write "数据库连接错误,请检查"
Response.End
else
conn.open connstr
if err then
err.clear
set conn=nothing
response.write "数据库连接错误,请检查"
Response.End
end if
end if

sub endConnection()
conn.close
set conn=nothing
end sub
%>

on error resume next
把这句去掉就可以看到错误提示了