<!--#include file="dataconn.asp"-->
<%
xh=trim(request.querystring("xh"))
stuname=trim(request.querystring("stuname"))
team=trim(request.querystring("team"))
set rs=conn.execute("select cxsetup from cominfo")
cxsetup=rs("cxsetup").value
rs.close
set rs=nothing   
if team="all" then 
sql="select * from studentpmb where stuidh='"&xh&"' and stuname='"&stuname&"'"
team="当前时段所有项目"
else
sql="select * from studentpmb where stuidh='"&xh&"' and stuname='"&stuname&"' and ksname='"&team&"'"
end if
on error resume next
set rs=conn.execute(sql)
if err then
response.write "对不起,还没有该次工资!"
response.end
end if
totalput=rs.RecordCount
if rs.eOF then
Response.Write escape("<font color=#ff0000>对不起,没有查询到该记录,请检查你输入的密码、姓名和查询项目是否对应!</font>")
response.end
end if

解决方案 »

  1.   

    <!--#include file="dataconn.asp"-->
    <%
    xh=trim(request.querystring("xh")) '获取表单传过来的XH的值,trim去掉空字符串
    stuname=trim(request.querystring("stuname"))
    team=trim(request.querystring("team"))
    set rs=conn.execute("select cxsetup from cominfo")'调用execute方法查询记录,不过我记得ASP在查询时一般也用OPEN的
    cxsetup=rs("cxsetup").value  '把查出cxsetup的值取出来
    rs.close                     '关闭记录集
    set rs=nothing               '销毁rs对象  
    if team="all" then           
    sql="select * from studentpmb where stuidh='"&xh&"' and stuname='"&stuname&"'"
    team="当前时段所有项目"
    else
    sql="select * from studentpmb where stuidh='"&xh&"' and stuname='"&stuname&"' and ksname='"&team&"'"
    end if  '这里根据不同的条件筛选不同的记录
    on error resume next
    set rs=conn.execute(sql)  
    if err then
    response.write "对不起,还没有该次工资!"  '在浏览器输出此语句
    response.end                           '程序结束执行
    end if
    totalput=rs.RecordCount                '取总记录数量
    if rs.eOF then                         '如果到达记录尾则表示没有记录
    Response.Write escape("<font color=#ff0000>对不起,没有查询到该记录,请检查你输入的密码、姓名和查询项目是否对应!</font>")
    response.end
    end if

    解释ASP?不知道能否满足你要求
      

  2.   

    <!--#include file="dataconn.asp"-->
    <%
    xh=trim(request.querystring("xh")) '获取表单传过来的XH的值,trim去掉空字符串
    stuname=trim(request.querystring("stuname"))
    team=trim(request.querystring("team"))
    set rs=conn.execute("select cxsetup from cominfo")'调用execute方法查询记录,不过我记得ASP在查询时一般也用OPEN的
    cxsetup=rs("cxsetup").value '把查出cxsetup的值取出来
    rs.close '关闭记录集
    set rs=nothing '销毁rs对象   
    if team="all" then   
    sql="select * from studentpmb where stuidh='"&xh&"' and stuname='"&stuname&"'"
    team="当前时段所有项目"
    else
    sql="select * from studentpmb where stuidh='"&xh&"' and stuname='"&stuname&"' and ksname='"&team&"'"
    end if '这里根据不同的条件筛选不同的记录
    on error resume next
    set rs=conn.execute(sql)   
    if err then
    response.write "对不起,还没有该次工资!" '在浏览器输出此语句
    response.end '程序结束执行
    end if
    totalput=rs.RecordCount '取总记录数量
    if rs.eOF then '如果到达记录尾则表示没有记录
    Response.Write escape("<font color=#ff0000>对不起,没有查询到该记录,请检查你输入的密码、姓名和查询项目是否对应!</font>")
    response.end
    end if
      

  3.   

    这是设置HTML文字颜色font color=#ff0000
      

  4.   

    请高手指点下,看看我这段代码哪里有问题,我想连接我的数据库,数据库里stuidh=登录密码stuname=登录姓名可是我输入数据库里的记录,为什么显示“对不起,没有查询到该记录,请检查你输入的密码、姓名和查询项目是否对应!”
      

  5.   

    case5166
    这么历害呀,少看你了呀
      

  6.   

    1.<!--#include file="dataconn.asp"-->数据库联接语句和连接对象创建封装在dataconn.asp文件中了2.从你的问题来看,你的数据库连接是正常打开的,但是你却调用了adodb.connection的CONN实例的execute方法进行查询数据。比如
    3. sql="select * from studentpmb where stuidh='"&xh&"' and stuname='"&stuname&"'"
    rs.open sql,conn,1,1 '应该是这种方式才是正确的,第一个参数为你的Sql语句,第二个参数为数据库联接对象,后面的两个参数记得是设置是否只读与移动游标,Vbs参数我习惯不加括号呵4. sql = "insert into note (FromUser,ToUser,MessageTitle,Message) values ('xxx','"&username&"','xxx!','xxx!')"
    conn.execute(sql)'这个只是用于操作增,删,改的无记录集返回的SQL语句,open用于有返回的记录集方式,所以不管怎么使用你都没有结果集返回来。5.补充下:response.end '并把缓存输出到浏览器,然后程序结束执行.6.Response.Write escape("<font color=#ff0000>对不起,没有查询到该记录,请检查你输入的密码、姓名和查询项目是否对应!</font>")以CSS实现比较好些<span style='color:##ff0000'>对不起,没有查询到该记录,请检查你输入的密码、姓名和查询项目是否对应!</span>建议先学习下CSS和基础的东东先