如果是上传到空间提供商的服务器,就不能用数据源的方法写入数据库,
如我在http://www.brinkster.com/的30M(支持MDB数据库)是这样实现的:
<%
dim conn
dim connstr
'on error resume next
call conn_init()
sub conn_init()
on error resume next
connstr="DBQ="+server.mappath("database/XXX.mdb")+";DefaultDir=;DRIVER={Microsoft Access Driver (*.mdb)};"
set conn=server.createobject("ADODB.CONNECTION")
if err.number<>0 then
err.clear
else
conn.open connstr
if err then
err.clear
end if
end if
end sub
sub endConnection
conn.close
set conn=nothing
end sub
%>
<% set rs=server.createobject("adodb.recordset")
sql="select * from User"
rs.open sql,conn,1,3
if err.number<>0 then
response.write "数据库操作失败:"&err.description
else
dim FoundUser
FoundUser=false
do while not (rs.eof or err.number<>0)
if ucase(rs("UserName"))=ucase(UserName) and ucase(rs("userpassword"))=ucase(oldpwd) then
FoundUser=True
rs("userpassword")=newpwd
rs.update
Msg="密码修改成功,请记住你的密码"
exit do
end if
rs.movenext
loop
if not FoundUser then
Msg="您的名字不存在或您的密码不正确"
founderror=true
end if
rs.close
end if %>