sql脚本的一个用法&怎样结合script脚本的例子

来源:互联网 发布:2018经济全球化的数据 编辑:程序博客网 时间:2024/05/17 04:30

<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>农信通查询</title>
<style type="text/css">
<!--
.style1 {color: #FF0000}
-->
</style>
<link href="format.css" rel="stylesheet" type="text/css">
</head>
<script language="javascript">
function canceluser(id)
{
if(confirm("确认?"))
{
 location.href="?op=DelUser&Phone=<%=Request("Phone")%>&id="+id
}
 //alert(id)
}
</script>

<%
if "" & request("Phone") <>"" then
 if Request("op")="DelUser" then
  'Delete user
  conn.execute "update t_common_active_user set Status='1',UnRegTime='" & now & "' where id="  &Requestint("id")
 end if
 response.write "订购关系:<br>"
 dim sql
 'ID Phone FeePhone RegTime Status ServiceName LastFeeMonth FirstFeeTime RegTimes UnRegTime FirstMonth AddMethed
 sql="select phone as 手机号码,RegTime as 订制时间,chinesename as 业务名称,CASE Status WHEN 0 THEN '正常用户' WHEN 1 THEN '已退订' END as 是否计费,UnRegTime as 取消时间,CASE LastFeeMonth WHEN 0 THEN '尚未计费' ELSE 'cast(LastFeeMonth as varchar(2))+月' end as 最后计费月份,'<a href=# onclick=""canceluser(' + cast(a.id as varchar(20)) + ')"">取消</a>' as 操作 from t_common_active_user a join t_common_service b on a.servicename=b.servicename    where extnumber like '09896%' and  a.Phone = '" & requestex("Phone") & "'"
 PrintRS_12580 conn.execute(sql)
end if

function PrintRS_12580(rs)
 dim vcolcolor,vtabletitlebackcolor,vtablebordercolor
 vcolcolor="#ffffff"
 vtabletitlebackcolor="#f0f0f0"
 vtablebordercolor="#e0e0e0"
 
 if  Typename(rs)<>"Recordset" then
  
  response.write "本次操作无结果集"

 end if

  response.write "<table  cellspacing='1' cellpadding='0' border=0  bgcolor='" & vtablebordercolor &"'>"
  Response.write("<TR height=25 bgcolor='" & vcolcolor & "' >")
  'For i=1 to rs.Fields.count
    'Response.write("<TD  height=25  bgcolor='" & Session("vtabletitlebackcolor") & "' >" & rs.Fields(i-1).type  & "</TD>")
  'Next
     
  'Response.write("</tr><TR height=25 bgcolor='" & Session("vcolcolor") & "' >")

  For i=1 to rs.Fields.count
    Response.write("<TD  height=25  bgcolor='" & vtabletitlebackcolor & "' >" & rs.Fields(i-1).name  & "</TD>")
  Next
  
  'Response.write("</tr><TR height=25 bgcolor='" & Session("vcolcolor") & "' >")

  'For i=1 to rs.Fields.count
    'Response.write("<TD  height=25  bgcolor='" & Session("vtabletitlebackcolor") & "' >" & rs.Fields(i-1).DefinedSize   & "</TD>")
  'Next
 
 
 
  Do While Not rs.EOF
    '///////////////////////行开输出始///////////////////////////
   Response.write("</tr><TR height=25 bgcolor='" & vcolcolor & "' >")
 
   '遍历每一个字段
   For i = 0 to rs.Fields.count-1
       
       Response.Write("<TD>" &   rs.Fields(i).value  & "&nbsp; </TD>")
       
      
   Next
   Response.Write("</Tr>")
   Response.Flush()

   rs.MoveNext
  Loop
 'end if
  response.write "</table><br><br>"
 set rs2=rs.nextrecordset
 if not rs2 is nothing then
  PrintRS rs2
 end if
end function

%>

原创粉丝点击