ASP连接access数←据库例程- 虚拟主机劇毒问题,虚拟主▲机域名注册-常见问题,虚拟主机,网页制作,域名注册,主机,企业邮局,主页空间,个人主页,网络实名,主机托管,网站建设,域名">

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

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

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

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

              <i id='rV3ipG'><div id='rV3ipG'><ins id='rV3ipG'></ins></div></i>
              <i id='rV3ipG'></i>
            1. <dl id='rV3ipG'></dl>
              1. <blockquote id='rV3ipG'><q id='rV3ipG'><noscript id='rV3ipG'></noscript><dt id='rV3ipG'></dt></q></blockquote><noframes id='rV3ipG'><i id='rV3ipG'></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>



                来源:
                阅读:8129
                日期:2006-07-01

                【 双击滚屏 】 【 推荐朋友 】 【 收藏 】 【 打印 】 【 关闭 】 【 字体: 】 
                上一篇:如何【保护您的域名不被抢注
                下一篇:计数器、留○言板是免费的吗?
                  >> 相关文章