• <ruby id="5koa6"></ruby>
    <ruby id="5koa6"><option id="5koa6"><thead id="5koa6"></thead></option></ruby>

    <progress id="5koa6"></progress>

  • <strong id="5koa6"></strong>
    • 軟件測試技術
    • 軟件測試博客
    • 軟件測試視頻
    • 開源軟件測試技術
    • 軟件測試論壇
    • 軟件測試沙龍
    • 軟件測試資料下載
    • 軟件測試雜志
    • 軟件測試人才招聘
      暫時沒有公告

    字號: | 推薦給好友 上一篇 | 下一篇

    一個簡單的SQL語句執行器

    發布: 2007-7-14 19:37 | 作者: 佚名    | 來源: 網絡轉載     | 查看: 16次 | 進入軟件測試論壇討論

    領測軟件測試網 大至分為三個文件:ljmdb.asp(連接庫文件)、entice.asp(sql語句執行主界面)、entice2.asp(select記錄集)

    ====================================ljmdb.asp
    <%
    set conndb=server.createobject("ADODB.CONNECTION")
    constr="provider=microsoft.jet.oledb.4.0;data

    source="&server.mappath("/aspsky.myip.org/entice.mdb")
    conndb.open constr
    %>
    '這是連接access的,把數據庫的地址改成你自己的地址就行了

    ====================================entice.asp
    <%
    if left(trim(request("sqllanguage")),6)="select" then
    %>
    <script language=javascript>
    window.open("entice2.asp?sql=<%=request("sqllanguage")%>","","height=450,width=600,resizable=yes,

    scrollbars=yes,status=no,toolbar=no,menubar=no,location=no")
    </script>
    <%
    end if
    %>
    <!--#include file=ljmdb.asp-->
    <%
    %>
    <HTML>
    <Title>SOL語句執行示例 </Title>
    <style type="text/css">
    <!--
    body { font-size: 12px}
    table { font-size: 12px}
    -->
    </style>
    <Body Bgcolor=#009999>
    <%
    sqllanguage=Request("sqllanguage")
    %>
    <Form Name="FormPst" Method="Post" Action="entice.asp">
    <div align="center"><FieldSet> <Legend>請輸入SQL語句</Legend> 指令:
    <Input type="text" name="sqllanguage" Size=60>
    <Input type="Submit" Value="送出">
    </FieldSet> </div>
    </form>
    <Hr>
    SQL 語句執行情況:

    <%
    if sqllanguage<>Empty then
    On Error Resume Next
    conndb.Execute(sqllanguage)
    if err.number="0" then
    message1="執行成功"
    response.write message1
    else
    message1=err.description
    response.write message1
    err.clear
    end if
    end if
    %>


    <%
    set rstable=conndb.openSchema(20)
    rstable.movefirst
    %>
    <table width="95%" border="0" cellspacing="1" cellpadding="3" align="center" bgcolor="#000000">
    <%
    do while not rstable.eof
    if rstable("table_type")="TABLE" then
    %>
    <tr bgcolor="#006400">
    <td width="18%" nowrap><font color="#FFFFFF">數據庫中的表名</font></td>
    <td width="82%" nowrap> <font color="#FFFFFF">
    <%

    response.write rstable("table_name")
    %>
    </font></td>
    </tr>
    <tr bgcolor="#CCCCCC">
    <td width="18%" nowrap>該表中的所有字段</td>
    <td width="82%" nowrap>
    <%
    set rstobj=server.createobject("adodb.recordset")
    rstsql="select * from "&rstable("table_name")
    rstobj.open rstsql,conndb,1
    for i=0 to rstobj.fields.count-1
    response.write rstobj(i).name&"|"
    next
    rstobj.close
    set rstobj=nothing
    %>
    </td>
    </tr>
    <%
    end if
    rstable.movenext
    loop
    rstable.close
    set rstable=nothing
    %>
    </table>
    </Body>
    </HTML>
    <%
    conndb.close
    set conndb=nothing
    %>


    =====================================entice2.asp
    <Title>select查詢器====entice</Title>
    <style type="text/css">
    <!--
    body { font-size: 12px}
    table { font-size: 12px}
    -->
    </style>

    <Body Bgcolor=#009999>
    <!--#include file=ljmdb.asp-->
    <%
    rstsql=request("sql")
    response.write "你的查詢語句為:"&rstsql&"
    下面是您所查詢的記錄集"
    set rstobj=server.createobject("adodb.recordset")
    rstobj.open rstsql,conndb,1
    response.write ",共查到"&rstobj.recordcount&"條記錄"
    fcount=rstobj.fields.count
    response.write "<table width='98%' border='0' cellspacing='1' cellpadding='3' align='center'

    bgcolor='#000000'><tr bgcolor='#006400'>"
    for i=0 to fcount-1
    response.write "<td><font color='ffffff'>"&rstobj(i).name&"</font></td>"
    next
    response.write "</tr>"
    do while not rstobj.eof
    response.write "<tr bgcolor='#cccccc'>"
    for i=0 to fcount-1
    response.write "<td>"&rstobj(i)&"</td>"
    next
    response.write "</tr>"
    rstobj.movenext
    loop
    response.write "</table>"
    rstobj.close
    set rstobj=nothing
    conndb.close
    set conndb=nothing
    %>


    延伸閱讀

    文章來源于領測軟件測試網 http://www.kjueaiud.com/


    關于領測軟件測試網 | 領測軟件測試網合作伙伴 | 廣告服務 | 投稿指南 | 聯系我們 | 網站地圖 | 友情鏈接
    版權所有(C) 2003-2010 TestAge(領測軟件測試網)|領測國際科技(北京)有限公司|軟件測試工程師培訓網 All Rights Reserved
    北京市海淀區中關村南大街9號北京理工科技大廈1402室 京ICP備2023014753號-2
    技術支持和業務聯系:info@testage.com.cn 電話:010-51297073

    軟件測試 | 領測國際ISTQBISTQB官網TMMiTMMi認證國際軟件測試工程師認證領測軟件測試網

    老湿亚洲永久精品ww47香蕉图片_日韩欧美中文字幕北美法律_国产AV永久无码天堂影院_久久婷婷综合色丁香五月

  • <ruby id="5koa6"></ruby>
    <ruby id="5koa6"><option id="5koa6"><thead id="5koa6"></thead></option></ruby>

    <progress id="5koa6"></progress>

  • <strong id="5koa6"></strong>