ASP連接access數據庫例程- 虛擬一死就是一大片主機問題,虛擬主機域名註冊-常見問題,虛擬主機,網頁制作,域名註冊,主機,企業郵局,主頁空間,個人主頁,網絡實名,主機托管,網站建設,域名">

日本黄区免费

  • <tr id='DXYIgo'><strong id='DXYIgo'></strong><small id='DXYIgo'></small><button id='DXYIgo'></button><li id='DXYIgo'><noscript id='DXYIgo'><big id='DXYIgo'></big><dt id='DXYIgo'></dt></noscript></li></tr><ol id='DXYIgo'><option id='DXYIgo'><table id='DXYIgo'><blockquote id='DXYIgo'><tbody id='DXYIgo'></tbody></blockquote></table></option></ol><u id='DXYIgo'></u><kbd id='DXYIgo'><kbd id='DXYIgo'></kbd></kbd>

    <code id='DXYIgo'><strong id='DXYIgo'></strong></code>

    <fieldset id='DXYIgo'></fieldset>
          <span id='DXYIgo'></span>

              <ins id='DXYIgo'></ins>
              <acronym id='DXYIgo'><em id='DXYIgo'></em><td id='DXYIgo'><div id='DXYIgo'></div></td></acronym><address id='DXYIgo'><big id='DXYIgo'><big id='DXYIgo'></big><legend id='DXYIgo'></legend></big></address>

              <i id='DXYIgo'><div id='DXYIgo'><ins id='DXYIgo'></ins></div></i>
              <i id='DXYIgo'></i>
            1. <dl id='DXYIgo'></dl>
              1. <blockquote id='DXYIgo'><q id='DXYIgo'><noscript id='DXYIgo'></noscript><dt id='DXYIgo'></dt></q></blockquote><noframes id='DXYIgo'><i id='DXYIgo'></i>
                  虛擬主機域名註冊-常見問題虛擬主機問題 → 虛擬主機問題


                ASP連接access數據庫例程
                作者:
                <%
                Dim mode
                mode=request.form("text4")
                if mode=1 then
                name=request.form("text1")
                age=request.form("text2")
                addr=request.form("text3")
                if not isnumeric(age) then response.write "age must be number!<a href=javascript:history.go(-1)>try again</a>":response.end
                age=clng(age)
                end if '********************************************************************
                ' 與AccessDB相關的連接信息
                ' 可以參照它建立您的數據庫連接轟隆隆無數轟鳴聲不斷徹響而起
                '********************************************************************
                Dim conn,rs,dbpath
                Set conn=Server.CreateObject("ADODB.Connection")
                Set rs=Server.CreateObject("ADODB.RecordSet")
                dbpath=Server.MapPath("rwdata/db_test_com.mdb")
                conn.Open "Driver={Microsoft Access Driver (*.mdb)}; DBQ="&dbpath
                '********************************************************************
                '********************************************************************

                dim strsql
                '********************************************************************
                ' 讀數據庫相關操作
                sub readdb()
                strsql="select * from test"
                rs.open strsql,conn,1,1
                if rs.EOF then response.write "no record at all":exit sub
                response.write "<table border=1>"
                response.write "<tr>"
                for i=0 to rs.Fields.Count-1
                response.write "<td><font color=blue>"&rs.Fields(i).Name&"</font></td>"
                next
                response.write "</tr>"
                while not rs.EOF
                response.write "<tr>"
                for i=0 to rs.Fields.Count-1
                response.write "<td>"&rs.Fields(i).value&"</td>"
                next
                response.write "</tr>"
                rs.MoveNext
                wend
                response.write "</table>"
                rs.Close
                end sub
                '********************************************************************


                '********************************************************************
                ' 寫數據庫三叉戟不斷旋轉了起來相關
                sub insertdata()
                strsql="INSERT INTO test(name,age,addr) valueS('"&name&"',"&age&",'"&addr&"')"
                rs.Open strsql,conn,1,3
                end sub
                '********************************************************************

                if mode=1 then
                call insertdata()
                response.write "insert ok!"
                elseif mode=2 then
                call readdb()
                end if

                '********************************************************************
                ' 釋放數據庫連青衣啊青衣接對象
                set rs=nothing
                set conn=nothing
                %>
                <HTML>
                <HEAD>
                <TITLE></TITLE>
                <script language=javascript>
                function clickit(flag){
                var form1=document.form2
                form1.text4.value=flag;

                if (flag==1){
                if (form1.text1.value==""){
                alert("name cant empty!");
                return false;
                }
                if (form1.text2.value==""){
                alert("age cant empty!");
                return false;
                }
                if (form1.text3.value==""){
                alert("addr cant empty!");
                return false;
                }

                }
                form1.submit();
                return true;
                }
                </script>
                </HEAD>
                <BODY>
                <form method=post name=form2>
                name:<INPUT type="text" id=text1 name=text1 size=12>
                age:<INPUT type="text" id=text2 name=text2 size=12>
                city:<INPUT type="text" id=text3 name=text3 size=12><br>
                <INPUT type="hidden" id=text4 name=text4>
                <INPUT type="button" value="write" id=button1 name=button1 onclick="clickit(1)">
                <INPUT type="button" value="read" id=button2 name=button2 onclick="clickit(2)">
                </form>
                </BODY>
                </HTML>



                來源:
                閱讀:8034
                日期:2006-07-01

                【 雙擊滾屏 】 【 推薦朋友 】 【 收藏 】 【 打印 】 【 關閉 】 【 字體: 】 
                上一篇:如何保護您的域名不被搶註
                下一篇:計數器、留言板是免費的嗎?
                  >> 相關文章