源码网商城,靠谱的源码在线交易网站 我的订单 购物车 帮助

源码网商城

CJJ专用ASP类库中的某个class

  • 时间:2020-05-29 05:47 编辑: 来源: 阅读:
  • 扫一扫,手机访问
摘要:CJJ专用ASP类库中的某个class
作为程序员,相信每个人都有自己的函数库及类库。在做项目时,从库里面提取想要的函数及类。这样可以提高开发效率。CJJ专用ASP类库中的某个class
[url=]                  Else                       If cls_lPageNo >= cls_lTotalPage Then                           sResult = sResult & "<a href=""" & cls_sURL & "1"">首页</a>  <a href=""" & cls_sURL  & cls_lPageNo -1 & """>前页</a>  " & "后页  末页" & Chr(10)                       Else                           sResult = sResult & "<a href=""" & cls_sURL & "1"">首页</a> <a href=""" & cls_sURL  & cls_lPageNo -1 & """>前页</a> " & "<a href=""" & cls_sURL  & cls_lPageNo+1 & """>后页</a> <a href=""" & cls_sURL  & cls_lTotalPage & """>末页</a>" & Chr(10)                       End If                   End If                   sResult = sResult & " 页次:<strong>" & cls_lPageNo & "</strong>/" & cls_lTotalPage & "页 共<strong>" & cls_lTotalRecord & "</strong>条记录 <strong>" & cls_iPageSize & "</strong>条/页</td>" & Chr(10)                   sResult = sResult & "      <form name=""gopage"" action=""" & cls_sFormAction & """ method=""post"">" & Chr(10)                   sResult = sResult & "      <td> 第"                   sResult = sResult & "    <input type=""text"" name=""pageno"" class=""InputPage"" title=""请输入页号,然后回车"">页 " & Chr(10)                   sResult = sResult & "<input type=""submit"" class=""GotoPage"" value=""GO""></td></form></tr>" & Chr(10)           End If           sResult = sResult & "      </table>" & Chr(10) & "    </td>" & Chr(10) & "  </tr>" & Chr(10) & "</table>" & Chr(10)           '输出分页信息           Response.Write("result:" & sResult)       End Sub       '类销毁       Private Sub Class_Terminate()                If LCase(TypeName(cls_oConn))<>"nothing" Then               cls_oConn.Close               Set cls_oConn = Nothing           End If           If LCase(TypeName(cls_oRS))<>"nothing" Then        '       cls_oRS.Close               Set cls_oRS = Nothing           End If       End Sub       '*****************************************       ' 类型:    过程       ' 目的:    显示分页类中出现的错误信息       ' 输入:    无       ' 返回:    无       '*****************************************       Private Sub ShowErrors()           If cls_cls_sErrInfo <> "" Then               cls_cls_sErrInfo = "<ul>" & Chr(10) & cls_sErrInfo & "</ul>" & Chr(10)               Response.Write(cls_cls_sErrInfo)               Response.End           End If       End Sub   End Class   '----********************* TDBOperate *****************************----
稍提一个编码风格 个人觉得代码混排是个鸡肋,混排的可读性差,所以我一般都只是少量混排,尽量将代码和HTML分离。
<!--#include file="pubdb.asp"--> <%    '*****************************************   '类型:函数   '目的:报错   '参数:   'a_num:报错信息参数   '*****************************************   Private Function ShowError(a_Num)       Dim sErrInfo       sErrInfo = ""       Response.Write("<p>Error Number:era_" & a_Num & "</p>")       Select Case a_Num       Case "1000"           sErrInfo = "参数类型不正确,请检查"       Case "1100"           sErrInfo = "无法打开数据库连接"       Case Else           sErrInfo = "发现未知错误,请与管理员联系"       End Select       sErrInfo = "<p>Error Description:" & sErrInfo & "</p>"       Response.Write(sErrInfo)       Response.End   End Function   Dim oRS,sHtml   Call OpenDB()   Set oRS = oConn.OpenSchema(20)   sHtml=""   oRS.MoveFirst   '循环读取数据库中的表名   Do While Not oRS.EOF       If UCase(oRS(3))="TABLE" Then           sTemp = Trim(oRS(2))           If sTBName = sTemp Then               sHtml= sHtml & Space(2) & "<option value=""" & sTemp & """ selected=""selected"">" & sTemp & "</option>" & Chr(10)           Else               sHtml= sHtml & Space(2) & "<option value=""" & sTemp & """>" & sTemp & "</option>" & Chr(10)           End If       End If       oRS.MoveNext   Loop   Call CloseDB() %> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=gb2312" /> <title>数据库名</title> <script type="text/javascript"> <!--     var sDstID="";     function serverResult(a_sUrl,a_sSrcID,a_sDstID) {        var sValue = document.getElementById(a_sSrcID).value;        sDstID=a_sDstID;        if ((sValue == null) || (sValue == "")) return;        var sUrl = a_sUrl+sValue;        oXml.open("GET", sUrl,true);        oXml.onreadystatechange = updateData;        oXml.send(null);      }     function updateData() {         var aElmnts = sDstID.split(',');         var oElmnt = null;         var aTags=null;         var oXmlData=null;         if ((oXml.readyState == 4) && (oXml.status == 200)) {             aTags = oXml.responseXML.documentElement.getElementsByTagName("cjjitem");             if (aTags.length!=aElmnts.length) {                 alert('获取的服务器端的数据错误!');                 return null;             }             for (var i=0;i<aElmnts.length ;i++ ) {                 oElmnt = document.getElementById(aElmnts[i]);                 oElmnt.innerHTML=aTags[i].firstChild.data;             }         }         return true;     }     var oXml = false;     if (window.ActiveXObject) {         oXml = new ActiveXObject("Microsoft.XMLHTTP");     } else if (window.XMLHttpRequest) {         oXml=new XMLHttpRequest();     } //--> </script> </head> <body> <form method="POST" name="form1" action="addFormData.asp">     <p> </p>     <p>数据库名:<input type="text" name="txtDBName" size="7" value="work"> 数据库用户名:<input type="text" name="DBUserName" size="8" value="sa">数据库密码:<input type="password" name="DBUserPassWord" size="10" value=""> 数据库服务器路径:<input type="text" name="DBServerPath" size="20" value="127.0.0.1"></p>     <p>数据表名:<select size="1" id="sltTBName" name="sltTBName" onchange="serverResult('getFieldList.asp?n=','sltTBName','fieldcount,tblFields');">     <option selected="selected">请选择一个表</option>     <%=sHtml%>     </select></p> <div id="fieldcount">表字段个数:<input type="text" id="txtFldCount" name="txtFldCount" value="0" /></div>   <table id="tblFields" border="1" width="91%">     <thead>         <tr>             <td align="center" width="94">字段名</td>             <td align="center" width="113">字段类型</td>             <td width="27" align="center">使用</td>             <td width="18" align="center">只读</td>             <td align="center" width="80">表单项类型</td>             <td align="center" width="100">表单项名称</td>             <td align="center" width="92">表单项描述</td>             <td align="center" width="87">表单项验证</td>             <td align="center">表单项默认值</td>         </tr>      </thead>      <tbody>      </tbody>     </table>     <p align="left">需要生成的动态ASP网页类型:<select size="1" name="sltAspType">     <option value="0">数据添加</option>     <option value="1">数据编辑</option>     <option value="2">数据删除</option>     <option value="3">数据管理</option>     <option value="4">数据列表</option>     </select> 文件名:<input type="text" name="txtFileName" size="17" value="">     文件类型:<select size="1" name="sltFileType">     <option value="ASP">ASP</option>     <option value="PHP">PHP</option>     <option value="JSP">JSP</option>     <option value="PERL">PERL</option>     <option value="VB.NET">VB.NET</option>     <option value="C#">C#</option>     </select>     <input type="submit" value="生成文件" name="action"></p> </form> </body> </html>
  • 全部评论(0)
联系客服
客服电话:
400-000-3129
微信版

扫一扫进微信版
返回顶部