有没有人能回答啊!!数据库问题

k330j 2003-02-28 12:29:41
登录页面 login.htm
<%@ Language=VBScript %>
<HTML>
<HEAD>
<title>智人仓库管理系统</title>
</HEAD>
<BODY bgcolor=#c1f7d8>
<form action=login.asp method=post>
<table>
<tr>
<td><img src=file://C:\Inetpub\wwwroot\002.gif></td>
</tr>
<tr>
<td width=100% align=center><p><font size=5>员工登录</p></font></td>
</tr>
</table>
<table>
<tr>
<td width=63% align=right height=40>帐号:<br></td>
<td width=50%><input name=name style="height:22px;width:167px"><br></td>
</tr>
<tr>
<td width=63% align=right height=40>密码:<br></td>
<td width=50%><input type=password name=password style="height:22px;width:167px"><br></td>
</tr>
<tr>
<td width=40% align=right height=40><br></td>
<td width=30% align=left>
<input id=submitl name=submitl type=submit value=确定>
<input id=resetl name=resetl type=reset value=重填></td>
</tr>
</table>
</form>
<center> </center>
</BODY>
</HTML>

验证程序 login.asp

<%@ Language=VBScript %>
<%Response.Buffer=true%>
<HTML>
<HEAD>
</HEAD>
<BODY>
<body bgcolor=#clf7d8>
<center>
<%
dim strname,strpassword,sql
strname=Request.Form("name")
strpassword=Request.Form("password")
if strname="" then
Response.Write"帐号不能为空<p></p>"
%>
<a href=javascript:history.back()>上一页</a>
<%
Response.End
end if
if strpassword=""then
Response.Write"密码不能为空<p></p>"
%>
<a href=javascript:history.back()>上一页</a>
<%
Response.End
end if
sql="filedsn=c:\kcgl.dsn"
set dblink=server.CreateObject("adodb.connection")
dblink.Mode=3
dblink.Open sql
set rstemp=server.CreateObject("adodb.recordset")
rstemp.Open sql,"dsn=zyxx;uid=sa;pwd="
if rstemp.RecordCount=1 then
if rstemp("userpassword")=strpassword then
session("name")=strname
Response.Redirect"login.htm"
else
Response.Write"密码错误<br><br>"
end if
else
Response.Write"帐号错误<br><br>"
%>
<a href=javascript:history.back()>上一页</a>
<%
Response.End
end if
rstemp.Close
set rstemp=nothing
%>
</center>
</BODY>
</HTML>


我用的SQL数据库,数据源c:\kcgl.dan,用户信息表zyxx 有username.userpassword两个字段两个都是字符型.登陆页面运行正常.但输入数据就会出现

HTTP 500 - 内部服务器错误
Internet Explorer

我已经问过一次了程序也做了一定修改,但还是不能解决最根本问题,希望高手能仔细看看帮我找找问题,谢谢了


...全文
23 16 打赏 收藏 转发到动态 举报
写回复
用AI写文章
16 条回复
切换为时间正序
请发表友善的回复…
发表回复
BrightEye 2003-02-28
  • 打赏
  • 举报
回复
验证程序 login.asp

<%@ Language=VBScript %>
<%Response.Buffer=true%>
<HTML>
<HEAD>
</HEAD>
<BODY>
<body bgcolor=#clf7d8>
<center>
<%
dim strname,strpassword,sql
strname=Request.Form("name")
strpassword=Request.Form("password")
if strname="" then
Response.Write"帐号不能为空<p></p>"
%>
<a href=javascript:history.back()>上一页</a>
<%
Response.End
end if
if strpassword=""then
Response.Write"密码不能为空<p></p>"
%>
<a href=javascript:history.back()>上一页</a>
<%
Response.End
end if
sql="filedsn=c:\kcgl.dsn"
set dblink=server.CreateObject("adodb.connection") 'filedsn是干什么的???????
dblink.Mode=3 '???
dblink.Open sql '???
set conn=server.createobject("adodb.connection")
set rstemp=server.CreateObject("adodb.recordset")
sql="select * from table1 where username='"&strname&"'"
rstemp.Open sql,"dsn=zyxx;uid=sa;pwd=" 'rstemp.open sql,conn,1,1

if rstemp.RecordCount=1 then 'if not rstemp.eof then
if rstemp("userpassword")=strpassword then
session("name")=strname
Response.Redirect"login.htm" 'Why redirect login.htm?
else
Response.Write"密码错误<br><br>" 'response.write "帐号或用户名错误!"
end if
else
Response.Write"帐号错误<br><br>" 'response.write "帐号或用户名错误!"
%>
<a href=javascript:history.back()>上一页</a>
<%
Response.End
end if
rstemp.Close
set rstemp=nothing
'conn.close
'set conn=nothing
%>
</center>
</BODY>
</HTML>
wuxk 2003-02-28
  • 打赏
  • 举报
回复
验证程序 login.asp

<%@ Language=VBScript %>
<%
option explicit '打开此选项可提高脚本效率
'Response.Buffer=true
'如果你用win2000的话buffer默认是打开的,不需要自己设定为true
%>
<HTML>
<HEAD>
</HEAD>
<BODY>
<body bgcolor=#clf7d8>
<center>
<%
'你的代码有很多多余的,我给删去了。
dim strname,strpassword,dblink,sql,rstemp
strname=Request.Form("name")
strpassword=Request.Form("password")
if strname="" then
Response.Write "帐号不能为空<p></p>"
response.write "<a href=javascript:history.back()>上一页</a>"
Response.End
elseif strpassword=""then
Response.Write "密码不能为空<p></p>"
response.write "<a href=javascript:history.back()>上一页</a>" '这里用Response.Write输出会提高很多性能,否则不断在HTML和
'脚本间切换,浪费服务器资源
Response.End
end if
set dblink=server.CreateObject("adodb.connection")
'下面表示使用你电脑上设置的ODBC系统DSN,注意设置ODBC的时候指向你的表所在的数据库,SA的密码是否为空
dblink.Open "dsn=zyxx;uid=sa;pwd=" '这里假定你的系统DSN的名称为zyxx,SQL SERVER用户名为sa,密码为空
set rstemp=server.CreateObject("adodb.recordset")
'你原来的代码没有定义SQL语句
sql="select * from youTable where name ='" & strName & "'" '这里假定表名为 youTable,用户名字段为 name,密码字段为 password
rstemp.Open sql,dblink,3,1 '这里表示用dblink连接打开一个静态,不可更改的记录集,这样效率较高
if not rstemp.eof then '判断是否是记录尾比判断得到的记录个数效率高
if strPassword = rsTemp("password") then
session("name")=strname
Response.Redirect "login.htm"
else
Response.Write "密码错误<br><br>"
end if
else
Response.Write "帐号错误<br><br>"
response.write "<a href=javascript:history.back()>上一页</a>"
Response.End
end if
rstemp.Close
set rstemp=nothing
set dblink=nothing
%>
</center>
</BODY>
</HTML>
vitamin_ok 2003-02-28
  • 打赏
  • 举报
回复
看一看数据是否传递过来了,

显示一下sql的内容
response.write sql
response.end

看看sql里面的内容是否正确?
csdntoll 2003-02-28
  • 打赏
  • 举报
回复
兄弟,别着急,你把IE的[工具][Internet选项][高级][显示友好HTTP错误信息]的勾去掉,
然后把详细的出错信息贴出来,那么高手们就能帮到你拉
wscqstu 2003-02-28
  • 打赏
  • 举报
回复
呵呵,内部服務器錯誤,推建一個看清楚錯誤的方法,或許你已經知道了

先把你的驗證程序全部移走,用111代替你原來的驗證程序,然後提交,這時候

頁面是111,然後把你的驗證程序覆蓋111,這樣就會看到你真正的錯誤了!試試看??
k330j 2003-02-28
  • 打赏
  • 举报
回复
呵呵对了
在这里谢谢大家,特别是从此醉,问个不休,还草上飞
现在给分 从此醉75,问个不休75,草上飞50

(注:因为我是极品所以这个问题我问了两次,因为从此醉和问个不休在我另一个问上面也在,所以在这里给草上飞50.他们个25,然后在到另个问上给他们两个每人50,在这里非常感谢大家了)
caoshangfei 2003-02-28
  • 打赏
  • 举报
回复
strpassword = rstemp("userpassword") 改为:strpassword =trim(rstemp("userpassword"))
k330j 2003-02-28
  • 打赏
  • 举报
回复
<%@ Language=VBScript %>
<%option explicit%>
<HTML>
<HEAD>
</HEAD>
<BODY>
<body bgcolor=#clf7d8>
<center>
<%
dim strname,strpassword,sql,dblink,rstemp
strname=Request.Form("name")
strpassword=Request.Form("password")
if strname="" then
Response.Write"帐号不能为空<p></p>"
Response.Write"<a href=javascript:history.back()>上一页</a>"
Response.End
elseif strpassword="" then
Response.Write"密码不能为空<p></p>"
Response.Write"<a href=javascript:history.back()>上一页</a>"
Response.End
end if
sql="filedsn=c:\kcgl.dsn"
set dblink=server.CreateObject("adodb.connection")
dblink.Mode=3
dblink.Open sql
set rstemp=server.CreateObject("adodb.recordset")
rstemp.Open "select * from zyxx where username ='" & strName & "'",dblink,3,1
if not rstemp.eof then
if strpassword = rstemp("userpassword") then
session("name")=strname
Response.Redirect "login.htm"
else
Response.Write "密码错误<br><br>"
end if
else
Response.Write "帐号错误<br><br>"
response.write "<a href=javascript:history.back()>上一页</a>"
Response.End
end if
rstemp.Close
set rstemp=nothing
set dblink=nothing
%>
</center>
</BODY>
</HTML>


经过调试基本都正常了,只是还有个问题就是不管我输入什么密码都说密码错误
请高手看看
k330j 2003-02-28
  • 打赏
  • 举报
回复
<%@ Language=VBScript %>
<%option explicit%>
<HTML>
<HEAD>
</HEAD>
<BODY>
<body bgcolor=#clf7d8>
<center>
<%
dim strname,strpassword,sql,dblink,rstemp
strname=Request.Form("name")
strpassword=Request.Form("password")
if strname="" then
Response.Write"帐号不能为空<p></p>"
Response.Write"<a href=javascript:history.back()>上一页</a>"
Response.End
elseif strpassword="" then
Response.Write"密码不能为空<p></p>"
Response.Write"<a href=javascript:history.back()>上一页</a>"
Response.End
end if
set dblink=server.CreateObject("adodb.connection")
dblink.Open"dsn=kcgl;uid=sa;pwd=" '23行
set rstemp=server.CreateObject("adodb.recordset")
sql="select * from zyxx where username ='" & strName & "'"
rstemp.Open sql,dblink,3,1
if not rstemp.eof then
if strPassword = rsTemp("password") then
session("name")=strname
Response.Redirect "login.htm"
else
Response.Write "密码错误<br><br>"
end if
else
Response.Write "帐号错误<br><br>"
response.write "<a href=javascript:history.back()>上一页</a>"
Response.End
end if
rstemp.Close
set rstemp=nothing
set dblink=nothing
%>
</center>
</BODY>
</HTML>


Microsoft OLE DB Provider for ODBC Drivers 错误 '80004005'

[Microsoft][ODBC 驱动程序 管理器] 未发现数据源名称并且未指定默认驱动程序

/lxk/login.asp,行23


这个是什么问题啊
wangwanfu 2003-02-28
  • 打赏
  • 举报
回复
有可能是权限问题
如果你的操作系统是WIN2000的话,你按下面的步骤操作一下试试:
开始--程序--管理工具--计算机管理--本地用户和组--用户--右键单击"启动IIS进程帐号"--点击属性--选中用户不能更改密码和密码永不过期两项
windancer 2003-02-28
  • 打赏
  • 举报
回复
filedsn=c:\kcgl.dsn可能有问题吧
k330j 2003-02-28
  • 打赏
  • 举报
回复
DNS我配置好了的,我遍的添加用户程序都可以正常添加
蘑菇 2003-02-28
  • 打赏
  • 举报
回复
你应该用系统的dns
k330j 2003-02-28
  • 打赏
  • 举报
回复
Microsoft OLE DB Provider for ODBC Drivers 错误 '80004005'

[Microsoft][ODBC 驱动程序 管理器] 未发现数据源名称并且未指定默认驱动程序

/lxk/login.asp,行32


这个是错误信息,我现在在修改,各位有补充没啊??
wuxk 2003-02-28
  • 打赏
  • 举报
回复

它原来的代码就是有问题嘛,你没看你上面那位都改了那么多。搞不好他的DNS都没配对。唉,就算为他解决了这个问题又怎么样,也是徒劳,天知道他还知道什么。
Bullforg 2003-02-28
  • 打赏
  • 举报
回复
查看客户提交数据是否正常

不过这个问题一般不一定是代码问题,可能出在服务器设置上!

28,390

社区成员

发帖
与我相关
我的任务
社区描述
ASP即Active Server Pages,是Microsoft公司开发的服务器端脚本环境。
社区管理员
  • ASP
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧