春节义务帮人写了一个《求签在线查询》(ASP)

点击:http://webds.sz800.cn/wg2009.asp看效果

 

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<meta http-equiv="content-type" content="text/html;charset=gb2312">
<title>《王公灵签在线查询》(Ver 2009.02.07)</title>
<style type="text/css">
body{margin:0px;background:brown;font-size:12px;}
#welcome{position:absolute;width:660px;height:440px;background:url(wgimage/welcome.jpg);
         top:50%;left:50%;margin-top:-220px;margin-left:-330px;}
#inputdiv{margin-left:300px;margin-top:100px;color:gray;font-size:12px}

#inputdiv hr{width:200px;text-align:left;}
#inputdiv input{border:0px;border-bottom:1px solid gray;font-size:5em;
          color:red;width:64px;margin-bottom:-20px;}
#inputdiv span{font-size:3em;}
#inputdiv a {color:red;}
#inputdiv input.button { border:1px solid gray;font-size:12px;
                         border-right:1px solid black;border-bottom:1px solid black;
                         padding:2px;}
#big {position:absolute;padding-left:54px;top:14px;}
#left {background:url(wgimage/l.gif); repeat:none;width:13px;height:548px;float:left;}
#mid {background:url(wgimage/m.gif);background-repeat:repeat-x;
      width:740px;height:548px;
      white-space:nowrap; display:block;
      color:black;font-family:楷体;
      font-size:17px;
      padding-top:44px;
      float:left;
      }
#mid span{color:red;font-weight:bold;}
#mid span.t1{font-size:30px;color:maroon;font-weight:bold;}
#right{background:url(wgimage/r.gif);width:96px;height:548px;}
.ret{border:1px solid white;font-size:12px;
                         border-right:1px solid black;border-bottom:1px solid black;
                         padding:2px;background:orange;color:brown;}
p{
writing-mode: tb-rl; padding:0px;margin:0px;
}
</style>
</head>
<%
'自定义函数部分
dim oConn,oRS,islogin,totalcount,todatcount
dim thisYear,allYear,allAbout
zdm=split("签号|卦类|签诗|诗曰|家宅|岁君|求财|移居|月令|谋事|六甲|婚姻|合夥|山坟|官讼|占病|失物|行人|海水|田蚕|功名|出外|遇风|六畜|子息","|")
islogin = False
Sub DBOpen(dbname)
 Set oConn = Server.CreateObject("ADODB.Connection")
 oConn.Open "Provider=Microsoft.Jet.OLEDB.4.0; Data Source= '" & Server.MapPath(".") & dbname & "'"
 Set oRs = Server.CreateObject( "ADODB.Recordset" )
End Sub
Sub DBClose()

 On Error Resume Next
 oRs.Close
 Set oRs = Nothing
 oConn.Close
 Set oConn = Nothing
End Sub

function getzw(n)
 zw=split("一|二|三|四|五|六|七|八|九|拾","|")
 if n<=10 then
  getzw = zw(n-1)
 end if  
 
 if n>10 and n<20 then
   a = int(n/10)
   b = n - a*10
   getzw = "十"+zw(b-1)
 end if
 
 if n>=20 then
   a = int(n/10)
   b = n - a*10
   if b<>0 then
   getzw =zw(a-1)+"十"+zw(b-1)
   else
   getzw =zw(a-1)+"十"
   end if
 end if
 
end function
Dbopen("/TEST.mdb")
oRS.open "SELECT * FROM ncount",oConn,1,3
if Session("nowvisit")<>"Y" then
   Session("nowvisit")="Y"
   oRS("统计")=oRS("统计")+1
   oRS("今日统计")=oRS("今日统计")+1
   if date > oRS("日期") then
       oRS("日期") = date
       oRS("今日统计")=0
   end if
   oRS.update
end if
   totalcount=oRS("统计")
   todaycount=oRS("今日统计")
dbclose
xs=request.form("xs")
%>
<body>
<% if request.form("xs")<>"显示" then %>
<div id="welcome">
  <div id="inputdiv">
  鸣谢:对以下帮助录入的网友:<br>
        成诚、花友友、WESLEE、<br>
        赞赞就是我、梅川内酷、<br>
        haitan138等表示衷心感谢! <br>
  <br>
  <hr>
  请输入你要查询的签号(1-51):<br>
  <form name="sc" METHOD="POST" action="wg2009.asp">
  <span>第</span>
  <input type="text" value="34" name="qh" maxlength="2"
   οnfοcus="this.select()"
   οnkeyup='if(this.value!="")
            {re=//d/g;if(!re.test(this.value)){alert("只能输入1-51中的数字!");this.value="";}}
            if(parseInt(this.value)>51||parseInt(this.value)<1)
   {alert("只能输入1-51中的数字!");this.value="";}'>
  <span>签</span><br><br>&nbsp;&nbsp;&nbsp;&nbsp;
  <input type="hidden" value="显示" name="xs">
  <input type="submit" value="点击查询" class="button">
  <br><br><br><br><br>
  统计:<font color=red><%=totalcount%></font>&nbsp;今日:<font color=red><%=todaycount%></font>
  (<%=date%>)
  </form>
  </div>
 <% end if
    if request.form("xs")="显示" then
     if request.form("qh")="" then %>
   <script language="javascript">alert("请输入1-51中的数字!");history.go(-1);</script>
  <% end if
  %>
</div>
   <div id="big">
   <div id="left"></div>
   <div id="mid">
<p>
   <%
   if request.form("qh")<>"" then
      Dbopen("/TEST.mdb")
      oRS.open "SELECT * FROM content where 签号='"&request.form("qh")&"'",oConn,1,3
     if not oRS.eof then
   %><span class="t1">第<%=getzw(oRS("签号"))%>签&nbsp;
    <% if oRS("签诗")<>"第五十一签" then %>
    <%=oRS("签诗")%>
    <% end if %>
    </span>
    &nbsp;&nbsp<button class="ret" οnclick="history.go(-1);">继续查询</button><br><br><br>
    <span>卦类&nbsp;</span>&nbsp;<%=oRS("卦类")%><br>
    <span>诗曰&nbsp;</span>
     <% if len(ors("诗曰"))>18 then %>
    <%=left(ors("诗曰"),12)%><br>
    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
    <%=mid(ors("诗曰"),13,len(ors("诗曰"))-12)%><br>
    <%else%>
    <%=ors("诗曰")%><br>
    <%end if%>
    <br>
    <% for i=4 to Ubound(zdm) %>
    <span><%=zdm(i)%>&nbsp;</span>
    <% if len(oRS(zdm(i)))>17 then %>
    <%=left(oRS(zdm(i)),18)%><br>
    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
    <%=mid(oRS(zdm(i)),19,len(oRS(zdm(i)))-18)%><br>
    <%else%>
    <%=oRS(zdm(i))%><br>
    <%end if%>
    <% next %>
   </div>
   <div id="right"> </div>
 </p>
 </div>
<%    dbclose()
     end if
    end if
   end if %>
   </body>
</html>

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
当然可以!以下是一个基本的ASP.NET查询数据库的示例: 首先,确保你已经安装了ASP.NET和SQL Server,并且创建了一个数据库和一张表。 在ASP.NET页面的代码部分,你可以使用ADO.NET来连接并查询数据库。在这个示例中,我们将使用SqlConnection和SqlCommand类来实现。 ```csharp using System; using System.Data; using System.Data.SqlClient; public partial class Default : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { // 连接数据库 string connectionString = "YourConnectionString"; // 根据你的实际情况替换为数据库连接字符串 using (SqlConnection connection = new SqlConnection(connectionString)) { // 构建SQL查询语句 string query = "SELECT * FROM YourTable"; // 根据你的实际情况替换为表名 // 打开连接并执行查询 connection.Open(); SqlCommand command = new SqlCommand(query, connection); SqlDataReader reader = command.ExecuteReader(); // 读取并显示查询结果 while (reader.Read()) { string column1Value = reader["Column1"].ToString(); // 根据你的实际情况替换为列名 string column2Value = reader["Column2"].ToString(); // 根据你的实际情况替换为列名 // 在页面上显示查询结果 Response.Write("Column1: " + column1Value + "<br/>"); Response.Write("Column2: " + column2Value + "<br/><br/>"); } // 关闭连接和读取器 reader.Close(); connection.Close(); } } } } ``` 在上面的示例中,我们通过连接字符串创建一个SqlConnection对象,并且构建一个查询语句。然后,我们打开连接,并使用SqlCommand对象执行查询,并通过SqlDataReader对象读取结果。最后,在页面上显示查询结果。 请记得根据你的实际情况替换连接字符串、表名和列名。 希望这个示例对你有帮助!如果你有任何问题,请随时提问。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值