![]() |
#2
qq826164542010-11-20 18:37
|

谢谢大家的指导,
我又来发帖,
很尴尬很无奈~
我真不是伸手党

===================================================


之前经过论坛的各位朋友的耐心讲述,
现在我又遇到一个问题
= =...
希望大家能帮我,
我学会的话,
我肯定会在论坛帮助其他各位学弟的~
我主要是想往数据库添加注册页面的信息
比如 帐号 密码 邮箱
提交给数据后,出现错误 ''80004005''
还请烦劳各位大哥大姐
指点下好吗?

Microsoft OLE DB Provider for ODBC Drivers error '80004005'
[Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified
/login.asp, line 17
[Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified
/login.asp, line 17
下面是程序源码:
我数据源也配置了的,Mysql驱动也装了
可是还是这样的问题~
不知道是不是跟IIS有关?
按照上述提示的内容说在17行有错误无权访问
也就是下面的conn.open connstr这段代码.

<%SqlLocalName = "qq82616454."
SqlUserName = "root"
SqlPassword = "root"
SqlDataBase = "odinms"
set conn = server.createobject("ADODB.Connection")
connStr = "Driver={MySQL ODBC 3.51 Driver};Server=" & SqlLocalName & ";Port=3306;Database=" & SqlDataBase & ";User=" & SqlUserName & "; Password=" & SqlPassword & ";Option=3;"
conn.open connstr
conn.CursorLocation=3
set rs = server.createobject("ADODB.Recordset")%>
<!--#include file="MswsServer_Config.asp" -->
<!--#include file="function.asp" -->
<!--#include file="Sha1.asp" -->
<%if RegClose2 = 1 then
call msg("抱歉,注册功能已经关闭.转向首页!","index.html")
end if%>
<%if request("add") = "1" then
starRegx = "^\w+$"
dim regx
set regx=new regexp
regx.pattern= starRegx
img = ucase(replace(request("img"),"'",""))
if img <> Session("pSN") then call msg("验证码错误,请确认后重新填写!","reg1.asp")
username = replace(request("name"),"'","")
password = replace(request("password"),"'","")
password1 = replace(request("password1"),"'","")
email = replace(request("email"),"'","")
bh1 = replace(request("bh1"),"'","")
bh2 = replace(request("bh2"),"'","")
if len(username) > 12 or len(username) < 4 then call msg("帐号长度不正确,请确认是否超过12个字符或小于4个字符.","reg1.asp")
if regx.test(username)=false then call msg("帐号必须为英文字母或数字!请从新输入!","reg1.asp")
if len(password) > 12 or len(password) < 4 then call msg("密码长度不正确,请确认是否超过12个字符或小于4个字符.","reg1.asp")
if password <> password1 then call msg("请确认两次密码是否相同!","reg1.asp")
lAt = False
lDot = false
for x = 2 to len(email)-1
if mid(email,x,1) = "@" then lAt = True
if mid(email,x,1) = "." and lAt = True then lDot = True
next
if lAt <> True or lDot <> True then call msg("EMAIL格式不正确请从新输入EMAIL!","reg1.asp")
sqlstr = "SET NAMES gb2312"
rs.Open sqlstr, conn, 1, 1
sql = "select name from accounts where name = '" & username & "'"
rs.open sql,conn,1,1
if not rs.eof and not rs.bof then
call msg("帐号 [ " & username & " ] 已被注册,请更换新的帐号尝试!","reg1.asp")
end if
rs.close
sql = "INSERT INTO accounts (name,password,email,securequestion,secureanswer,sha1pwd,banreason,macs) VALUES "
sql = sql & "('"&username&"','"&lCase(sha1(password))&"','"&email&"','"&bh1&"','"&bh2&"','"&lCase(sha1(password))&"',0,'00-00-00-00-00-00')"
conn.Execute sql
call closedb
call msg("您的帐号创建成功!","index.html")
end if%>
SqlUserName = "root"
SqlPassword = "root"
SqlDataBase = "odinms"
set conn = server.createobject("ADODB.Connection")
connStr = "Driver={MySQL ODBC 3.51 Driver};Server=" & SqlLocalName & ";Port=3306;Database=" & SqlDataBase & ";User=" & SqlUserName & "; Password=" & SqlPassword & ";Option=3;"
conn.open connstr
conn.CursorLocation=3
set rs = server.createobject("ADODB.Recordset")%>
<!--#include file="MswsServer_Config.asp" -->
<!--#include file="function.asp" -->
<!--#include file="Sha1.asp" -->
<%if RegClose2 = 1 then
call msg("抱歉,注册功能已经关闭.转向首页!","index.html")
end if%>
<%if request("add") = "1" then
starRegx = "^\w+$"
dim regx
set regx=new regexp
regx.pattern= starRegx
img = ucase(replace(request("img"),"'",""))
if img <> Session("pSN") then call msg("验证码错误,请确认后重新填写!","reg1.asp")
username = replace(request("name"),"'","")
password = replace(request("password"),"'","")
password1 = replace(request("password1"),"'","")
email = replace(request("email"),"'","")
bh1 = replace(request("bh1"),"'","")
bh2 = replace(request("bh2"),"'","")
if len(username) > 12 or len(username) < 4 then call msg("帐号长度不正确,请确认是否超过12个字符或小于4个字符.","reg1.asp")
if regx.test(username)=false then call msg("帐号必须为英文字母或数字!请从新输入!","reg1.asp")
if len(password) > 12 or len(password) < 4 then call msg("密码长度不正确,请确认是否超过12个字符或小于4个字符.","reg1.asp")
if password <> password1 then call msg("请确认两次密码是否相同!","reg1.asp")
lAt = False
lDot = false
for x = 2 to len(email)-1
if mid(email,x,1) = "@" then lAt = True
if mid(email,x,1) = "." and lAt = True then lDot = True
next
if lAt <> True or lDot <> True then call msg("EMAIL格式不正确请从新输入EMAIL!","reg1.asp")
sqlstr = "SET NAMES gb2312"
rs.Open sqlstr, conn, 1, 1
sql = "select name from accounts where name = '" & username & "'"
rs.open sql,conn,1,1
if not rs.eof and not rs.bof then
call msg("帐号 [ " & username & " ] 已被注册,请更换新的帐号尝试!","reg1.asp")
end if
rs.close
sql = "INSERT INTO accounts (name,password,email,securequestion,secureanswer,sha1pwd,banreason,macs) VALUES "
sql = sql & "('"&username&"','"&lCase(sha1(password))&"','"&email&"','"&bh1&"','"&bh2&"','"&lCase(sha1(password))&"',0,'00-00-00-00-00-00')"
conn.Execute sql
call closedb
call msg("您的帐号创建成功!","index.html")
end if%>
[ 本帖最后由 qq82616454 于 2010-11-20 18:29 编辑 ]