| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 450 人关注过本帖
标题:[求助]网站数据库原来是SQL换成Access后数据无法写入
只看楼主 加入收藏
gemrui
Rank: 1
等 级:新手上路
帖 子:2
专家分:0
注 册:2006-5-12
收藏
 问题点数:0 回复次数:0 
[求助]网站数据库原来是SQL换成Access后数据无法写入

我的网站数据库原来用的是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
%>

搜索更多相关主题的帖子: Access 数据库 SQL 
2006-05-12 01:00
快速回复:[求助]网站数据库原来是SQL换成Access后数据无法写入
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.011252 second(s), 7 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved