找回密码
 注册
搜索
热搜: 回贴
  • 前程无忧官网首页 有什么好的平台可以
  • 最新的销售平台 互联网营销的平台有哪
  • 制作网页的基本流程 网页制作和网页设
  • 【帝国CMS】输出带序号的列表(数字排
  • 网站建设公司 三一,中联,极东泵车的
  • 织梦 建站 织梦网站模版后台怎么更改
  • 云服务官网 哪些网站有免费的简历模板
  • 如何建网站要什么条件 建网站要用什么
  • 吉林市移动公司电话 吉林省退休人员网
  • 设计类毕业论文 网站设计与实现毕业论
查看: 275|回复: 8

为什么这个语句不能连接到数据库?

[复制链接]
发表于 2010-1-14 07:43:37 | 显示全部楼层 |阅读模式 IP:江苏扬州
<%OPTION EXPLICIT%>
<!--#include file="../include/db/connect_sqlserver.asp"-->
<%
session("isLog")=true
if session("isLog")=true then%>


......

<%
dim uSQL,rsServe,userName,departmentName,userPhone
searchDate=request("searchDate")
set rsServe=server.createobject("adodb.recordset")
uSQL="select userName,departmentName,userPhone from tbl_serve_user a,tbl_serve_department b where a.ID='"&session("ID")&"' and b.departmentID=a.departmentID "
rsServe.open uSQL,conn,3,2
if rsServe.eof then
response.write "系统出现故障,请和管理员联系!"
response.end
end if
userName=rsServe("userName")
departmentName=rsServe("departmentName")
userPhone=rsServe("userPhone")
rsServe.close
%>
大体意思是我要通过session获取登陆用户的用户名还有部门和电话
上面的连接应该是没有问题的,因为这个网站还能登陆
但是为什么一加上这些代码就不能打开那张网页了呢?
请高手指点
发表于 2010-1-14 07:43:41 | 显示全部楼层 IP:江苏扬州
提示什么错误?第几行?
加上哪段代码不能登陆?是不是这行?
<%
session("isLog")=true
if session("isLog")=true then%>

......
<%
dim uSQL,rsServe,userName,departmentName,userPhone
searchDate=request("searchDate")
set rsServe=server.createobject("adodb.recordset")
uSQL="select userName,departmentName,userPhone from tbl_serve_user a,tbl_serve_department b where a.ID='"&session("ID")&"' and b.departmentID=a.departmentID "
rsServe.open uSQL,conn,3,2
if rsServe.eof then
response.write "系统出现故障,请和管理员联系!"
response.end
end if
userName=rsServe("userName")
departmentName=rsServe("departmentName")
userPhone=rsServe("userPhone")
rsServe.close
%>

我只看出来这里不对
if rsServe.eof then
response.write "系统出现故障,请和管理员联系!"
response.end
end if
userName=rsServe("userName")
departmentName=rsServe("departmentName")
userPhone=rsServe("userPhone")

应该改成
if rsServe.eof then
response.write "系统出现故障,请和管理员联系!"
response.end
else
userName=rsServe("userName")
departmentName=rsServe("departmentName")
userPhone=rsServe("userPhone")
end if
回复

使用道具 举报

发表于 2010-1-14 07:43:44 | 显示全部楼层 IP:江苏扬州
直接提示http500错误,
下面就是一个表格然后需要上面说得这几个字段
回复

使用道具 举报

发表于 2010-1-14 07:43:48 | 显示全部楼层 IP:江苏扬州
贴上来偶看看

终于知道你是马甲了
回复

使用道具 举报

发表于 2010-1-14 07:43:52 | 显示全部楼层 IP:江苏扬州
设置一下浏览器,才能显示具体是那行出了错误,出了什么错误。这么设置:

工具——〉internet选项——〉高级——〉把“显示友好的错误信息”前面的对号给勾掉——〉按确定

然后再运行这个页面就显示具体什么错误了,然后把错误贴上来我看看
回复

使用道具 举报

发表于 2010-1-14 07:43:57 | 显示全部楼层 IP:江苏扬州
<%OPTION EXPLICIT%>
<!--#include file="../include/db/connect_sqlserver.asp"-->
<!--#include file="../include/util.asp"-->
<%if session("isLog")=true then%>

<html>
<head>
<title>外包服务平台</title>
<meta http-equiv="Content-Type" content="text/html; charsRequestet=gb2312">
<link rel="stylesheet" href="../css/css.CSS">

<style type="text/css">
<!--
.style1 {
font-size: 24pt;
color: #0000FF;
}
-->
</style>
</head>
<body bgcolor="#FFFFFF" text="#000000">
<form name="requform" method="post" onsubmit="return submitit();" action="requeditsave.asp?requestID=<%=requestID%>">
<%
dim uSQL,rsUser,userClass
userClass=session("userClass")
set rsUser=server.createobject("adodb.recordset")
dim bm1,bm2,bm3,rsDepartment,parentID
if userClass=5 then
uSQL="select userName,userAccount,departmentID,DepartmentPlace,userPhone,userMail from tbl_request_user where ID='"&session("ID")&"'"
set rsUser=server.createobject("adodb.recordset")
rsUser.open uSQL,conn,3,1
set rsDepartment=server.createobject("adodb.recordset")
uSQL="select departmentName,parentID from tbl_request_department where departmentID='"&session("departmentID")&"'"
rsDepartment.open uSQL,conn,3,1
bm3=rsDepartment("departmentName")
parentID=rsDepartment("parentID")
rsDepartment.close
uSQL="select departmentName,parentID from tbl_request_department where departmentID='"&parentID&"'"
rsDepartment.open uSQL,conn,3,1
bm2=rsDepartment("departmentName")
parentID=rsDepartment("parentID")
rsDepartment.close
uSQL="select departmentName from tbl_request_department where departmentID='"&parentID&"'"
rsDepartment.open uSQL,conn,3,1
bm1=rsDepartment("departmentName")
rsDepartment.close
%>
<table class="listDataTable" id="DataTable" cellSpacing="2" cellPadding="1" width="695" border="1" style="border-collapse: collapse" bordercolor="#000000" height="322" align="center">

<caption class="style1">
<b>补添服务请求单</b> </caption>
<font color="#000000">
<tr id="ignore">
<td align="right" colSpan="6" height="2"></td>
</tr>
<tr>
<td width="84" height="22"><font color="#000000"><font color="#000000">提报人</font></font></td>
<td width="111"><FONT color=#000000>
<input name="userName" type="text" class="inputnormal" onFocus="this.className='inputedit';this.select()" onBlur="this.className='inputnormal'" size="15">
</FONT></td>
<td width="82">联系电话</td>
<td width="123"><FONT color=#000000>
<input name="userPhone" type="text" class="inputnormal" onFocus="this.className='inputedit';this.select()" onBlur="this.className='inputnormal'" size="15">
</FONT></td>
<td width="90">部门</td>
<td width="165"><FONT color=#000000>
<input name="departmentPlace" type="text" class="inputnormal" " onFocus="this.className='inputedit';this.select()" onBlur="this.className='inputnormal'" size="15">
</FONT></td>
</tr>
<tr>
<td height="22" width="84"><font color="#000000"><font color="#000000">服务人员</font></font></td>
<td width="111">&nbsp;<%=userName%></td>
<td width="82"><font color="#000000">责任部门</font></td>
<td width="123">&nbsp;<%=departmentName%></td>
<td width="90"><font color="#000000">联系电话</font></td>
<td width="165">&nbsp;<%=rsUser("userPhone")%></td>
</tr>
<tr>
<td width="84" height="22">问题类型</td>
<td width="111" height="22"><font color="#000000"><FONT color=#000000>
<input name="errorType" type="text" class="inputnormal" onFocus="this.className='inputedit';this.select()" onBlur="this.className='inputnormal'" size="15">
</FONT></font> </td>
<td width="82" height="22">紧急程度</td>
<td height="22" width="123"><FONT color=#000000>
<select name="requestUrge" id="select">
<option selected>-紧急程度-</option>
<option value="一般" >一般</option>
<option value="紧急">紧急</option>
</select>
</FONT> </td>
<td style="font-size: 9pt; color: #000000" id="tishi" width="90"><font color="#000000">请求时间</font></td>
<td id="tishi" style="font-size: 9pt; color: #000000" width="165"><FONT color=#000000><FONT
color=#000000>
<input name="sendTime" type="text" class="inputnormal" " onFocus="this.className='inputedit';this.select()" onBlur="this.className='inputnormal'" size="15">
</FONT></FONT></td>
</tr>
<tr>
<td height="22">反馈时间</td>
<td height="22"><font color="#000000"> <FONT color=#000000><FONT color=#000000>
<input name="returnTime" type="text" class="inputnormal" " onFocus="this.className='inputedit';this.select()" onBlur="this.className='inputnormal'" size="15">
</FONT></FONT></font></td>
<td id="tishi" style="font-size: 9pt; color: #000000">承诺时间</td>
<td id="tishi" style="font-size: 9pt; color: #000000"><FONT color=#000000><FONT color=#000000>
<input name="promissTime" type="text" class="inputnormal" " onFocus="this.className='inputedit';this.select()" onBlur="this.className='inputnormal'" size="15">
</FONT></FONT></td>
<td height="22"><font color="#000000">服务完成时间</font></td>
<td height="22"><FONT color=#000000><FONT color=#000000>
<input name="serviceFinish" type="text" class="inputnormal" onFocus="this.className='inputedit';this.select()" onBlur="this.className='inputnormal'" size="15">
</FONT></FONT></td>
</tr>
<tr>
<td colspan="6" height="2">报修描述</td>
</tr>
<tr>
<td colspan="6" height="41">
<div align="center"><font color="#000000">
<font color="#000000">
<textarea name="requestDescription" cols="95" rows="6" class="inputnormal" onFocus="this.className='inputedit';this.select()" onBlur="this.className='inputnormal'"></textarea>
</font> </font> </div>
</td>
</tr>
<tr>
<td colspan="6" height="2">工程师反馈</td>
</tr>
<tr>
<td colspan="6" height="12">
<div align="center">
<FONT color=#000000><FONT color=#000000>
<textarea name="confirmContent" cols="95" rows="6" class="inputnormal" onFocus="this.className='inputedit';this.select()" onBlur="this.className='inputnormal'"></textarea>
</FONT></FONT> </div>
</td>
</tr>
<tr>
<td colspan="6" height="2">故障描述</td>
</tr>
<tr>
<td colspan="6" height="58">
<div align="center">
<FONT color=#000000><FONT color=#000000>
<textarea name="wrongDescription" cols="95" rows="6" class="inputnormal" onFocus="this.className='inputedit';this.select()" onBlur="this.className='inputnormal'"></textarea>
</FONT></FONT> </div>
</td>
</tr>
<tr>
<td colspan="6" height="2">故障原因</td>
</tr>
<tr>
<td colspan="6" height="63">
<div align="center">
<FONT color=#000000><FONT color=#000000>
<textarea name="wrongReasion" cols="95" rows="6" class="inputnormal" onFocus="this.className='inputedit';this.select()" onBlur="this.className='inputnormal'"></textarea>
</FONT></FONT> </div>
</td>
</tr>
<tr>
<td colspan="6" height="2">解决方案</td>
</tr>
<tr>
<td colspan="6" height="2">
<div align="center"><font color="#000000">
<FONT color=#000000>
<textarea name="wrongSolution" cols="95" rows="6" class="inputnormal" onFocus="this.className='inputedit';this.select()" onBlur="this.className='inputnormal'"></textarea>
</FONT> </font> </div>
</td>
</tr>
<tr>
<td colspan="6" height="2">用户意见</td>
</tr>
<tr>
<td colspan="6" height="2">
<div align="center">
<textarea name="requ_desp" cols="95" class="areanormal" rows="6" readonly><%=evaluateFeedback%></textarea>
</div>
</td>
</tr>
<tr id="ignore">
<td height="2" colSpan="6" align="right"></td>
</tr>
</font>
</table>
<div align="right"><br>
<br>
<input name="Submit" type="submit" class="s02" value="提交">
<input type="button" name="Submit2" value="关闭" onclick="javascript:<% if session("userClass")="4" and requestState="0" then %>window.opener.document.location.reload(); <%end if%> self.close();" class="s02">
</div>
</form>
</body>
</html>

<%'else
'response.redirect "../default.asp"
'end if
%>
回复

使用道具 举报

发表于 2010-1-14 07:44:01 | 显示全部楼层 IP:江苏扬州
报错提示如下:
Microsoft VBScript compilation error '800a03f6'
Expected 'End'
/daysummary/addorder.asp, line 210
回复

使用道具 举报

发表于 2010-1-14 07:44:05 | 显示全部楼层 IP:江苏扬州
丫代码还真长
头痛
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

QQ|小黑屋|最新主题|手机版|微赢网络技术论坛 ( 苏ICP备08020429号 )

GMT+8, 2024-9-29 13:24 , Processed in 0.452765 second(s), 12 queries , Gzip On, MemCache On.

Powered by Discuz! X3.5

© 2001-2023 Discuz! Team.

快速回复 返回顶部 返回列表