ÂÛÎÄÎÞÓÇÍøÌṩ£º¼ÆËã»ú±ÏÒµÂÛÎÄ·¶ÎÄ|¼ÆËã»ú±ÏÒµÉè¼Æ|¼ÆËã»ú±ÏÒµÂÛÎÄ
À¸Ä¿µ¼º½ ASP Java Web .NET VB6.0 JAVA VC VF DELPHI PB ¼ÆËã»úÍøÂç ¼ÆËã»ú¿ÆѧÓë¼¼Êõ PHP °²×¿APP ÆäËû C# ´úдÂÛÎÄ
µ±Ç°Î»ÖÃ: > ¼ÆËã»ú > ASP >

A450ASPͬѧ¼asp+sql

   

µÚÎåÕ     ÄÚÈÝÏêϸÉè¼Æ  http://www.paper51.com

5.1³ÌÐò±äÁ¿µÄ¶¨ÒåÓëÓ¦Óà paper51.com

±¾ÏµÍ³ÖеıäÁ¿¿ÉÒÔ¶¨Òå¿ÉÒÔ²»¶¨ÒåÖ»Óм¸¸ö×öÁËרÃŵĶ¨Òå

ÄÚÈÝÀ´×ÔÂÛÎÄÎÞÓÇÍø www.paper51.com

db ÊÇÁ¬½ÓÊý¾Ý¿âµÄ±äÁ¿ ÄÚÈÝÀ´×Ôwww.paper51.com

rs ¼Ç¼¼¯¶ÔÏó ÄÚÈÝÀ´×Ôwww.paper51.com

strsql SQL¶ÔÏó

ÄÚÈÝÀ´×ÔÂÛÎÄÎÞÓÇÍø www.paper51.com

5.2 Ä£¿éÏêϸÉè¼Æ paper51.com

5.2.1 ÁÄÌìÊÒ

http://www.paper51.com

¹ØÓÚÁÄÌìÊÒµÄËùÓÐÔ´³ÌÐò¶¼ÔÚxyl/ltsÏÂ,·Ö±ðÈçÏÂ:

paper51.com

index.asp---ÁÄÌìÊÒÊ×Ò³

http://www.paper51.com

chat.asp----ÁÄÌì½çÃæ¿ò¼ÜÖ÷Îļþ

ÄÚÈÝÀ´×Ôwww.paper51.com

input.asp---ÊäÈëÁÄÌìÄÚÈÝÎļþ copyright paper51.com

main.asp---ÏÔʾÁÄÌìÐÅÏ¢Îļþ paper51.com

exit.asp----Í˳öÁÄÌìÎļþ copyright paper51.com

ÁÄÌìÊÒÊ×Ò³Ö÷ÒªÏÔʾµ±Ç°ÔÚÏßÈËÊý,²¢ÒªÇóÓû§ÊäÈëêdzƺó½øÈëÁÄÌì½çÃæ.

ÄÚÈÝÀ´×ÔÂÛÎÄÎÞÓÇÍø www.paper51.com

³ÌÐòÈçÏÂ:

paper51.com

<ScriptLanguage="JavaScript"> ÄÚÈÝÀ´×ÔÂÛÎÄÎÞÓÇÍø www.paper51.com

   <!-- ÄÚÈÝÀ´×Ôwww.paper51.com

   function check_Null(){

http://www.paper51.com

       if(document.form1.user_name.value==""){ ÄÚÈÝÀ´×Ôwww.paper51.com

          alert("êdzƲ»ÄÜΪ¿Õ!");

ÄÚÈÝÀ´×ÔÂÛÎÄÎÞÓÇÍø www.paper51.com

          returnfalse; http://www.paper51.com

       } http://www.paper51.com

       returntrue; copyright paper51.com

   } http://www.paper51.com

   copyright paper51.com

// --> ÄÚÈÝÀ´×Ôwww.paper51.com

   </Script> copyright paper51.com

<table width="69%" height="158"border="1" align="center"bgcolor="#CCFFFF">

http://www.paper51.com

  <tr>

paper51.com

    <td><h2align="center">ÁÄÌìÊÒ</h2> ÄÚÈÝÀ´×ÔÂÛÎÄÎÞÓÇÍø www.paper51.com

      <center> ÄÚÈÝÀ´×Ôwww.paper51.com

       <%=Application("user_online")%>ÈËÔÚÏß ÄÚÈÝÀ´×ÔÂÛÎÄÎÞÓÇÍø www.paper51.com

       <p>

http://www.paper51.com

       <form method="post" action="chat.asp"name="form1" onsubmit="JavaScript: returncheck_Null();"> ÄÚÈÝÀ´×ÔÂÛÎÄÎÞÓÇÍø www.paper51.com

         ÊäÈëêÇ³Æ ÄÚÈÝÀ´×Ôwww.paper51.com

         <input type="text" name="user_name"size="10"> paper51.com

         <input name="submit" type="submit" value=" ½ø Èë"> copyright paper51.com

       </form>

copyright paper51.com

      </center>

ÄÚÈÝÀ´×ÔÂÛÎÄÎÞÓÇÍø www.paper51.com

      <divalign="center"></div></td>

ÄÚÈÝÀ´×Ôwww.paper51.com

  </tr> http://www.paper51.com

</table> copyright paper51.com

¿ò¼ÜÖ÷Îļþ³ÌÐòÈçÏÂ: ÄÚÈÝÀ´×Ôwww.paper51.com

<html> ÄÚÈÝÀ´×Ôwww.paper51.com

<head>

http://www.paper51.com

   <title>ÁÄÌìÊÒ</title> paper51.com

</head> ÄÚÈÝÀ´×ÔÂÛÎÄÎÞÓÇÍø www.paper51.com

   <%

ÄÚÈÝÀ´×ÔÂÛÎÄÎÞÓÇÍø www.paper51.com

   Session("user_name")=Request("user_name")   

ÄÚÈÝÀ´×ÔÂÛÎÄÎÞÓÇÍø www.paper51.com

   Dim sayStr

http://www.paper51.com

   ÄÚÈÝÀ´×ÔÂÛÎÄÎÞÓÇÍø www.paper51.com

sayStr="À´×Ô"& Request.ServerVariables("Remote_Addr")& "µÄ"   ÄÚÈÝÀ´×Ôwww.paper51.com

   sayStr=sayStr &"<b>" & Session("user_name") &"</b>"          ÄÚÈÝÀ´×ÔÂÛÎÄÎÞÓÇÍø www.paper51.com

   sayStr=sayStr & "ÓÚ"& Time & "À´ÁÙ"                     

http://www.paper51.com

   sayStr="<fontcolor='blue'>" & sayStr & "</font>"                 copyright paper51.com

   Application.Lock                                            copyright paper51.com

   Application("show")=sayStr & "<br>" & Application("show")      ÄÚÈÝÀ´×ÔÂÛÎÄÎÞÓÇÍø www.paper51.com

   Application("user_online")=Application("user_online")+1                                                    http://www.paper51.com

   %>

copyright paper51.com

   <framesetrows="*,14%"> http://www.paper51.com

       <framename="main" src="main.asp" > ÄÚÈÝÀ´×Ôwww.paper51.com

       <framename="input" src="input.asp">

http://www.paper51.com

       <noframes>

ÄÚÈÝÀ´×ÔÂÛÎÄÎÞÓÇÍø www.paper51.com

          <bodyscroll="no"> ÄÚÈÝÀ´×ÔÂÛÎÄÎÞÓÇÍø www.paper51.com

            <p>´ËÍøҳʹÓÃÁË¿ò¼Ü£¬µ«ÄúµÄä¯ÀÀÆ÷²»Ö§³Ö¿ò¼Ü¡£</p>

copyright paper51.com

           </body>

paper51.com

       </noframes>

ÄÚÈÝÀ´×ÔÂÛÎÄÎÞÓÇÍø www.paper51.com

   </frameset>

ÄÚÈÝÀ´×ÔÂÛÎÄÎÞÓÇÍø www.paper51.com

</html> http://www.paper51.com

ÊäÈëÁÄÌìÄÚÈÝÎļþÓÃÀ´ÊäÈë·¢ÑÔ,²¢¿ÉÒÔÑ¡Ôñ×ÅÉ«ºÍ±íÇé³ÌÐòÈçÏ£º

ÄÚÈÝÀ´×Ôwww.paper51.com

<html>

copyright paper51.com

<head>

ÄÚÈÝÀ´×ÔÂÛÎÄÎÞÓÇÍø www.paper51.com

   <title>·¢ÑÔÇø</title>

http://www.paper51.com

</head>

ÄÚÈÝÀ´×Ôwww.paper51.com

<body bgcolor="#CCFFFF" topmargin="0"leftmargin="0" onload="document.form1.say.focus();">

http://www.paper51.com

   <formmethod="post" action="" name="form1"> http://www.paper51.com

       ·¢ÑÔ:    paper51.com

       copyright paper51.com

<inputtype="text" name="say" size=40 >       copyright paper51.com

       <inputtype="submit" value="·¢ÑÔ" > copyright paper51.com

       <br>    ÄÚÈÝÀ´×ÔÂÛÎÄÎÞÓÇÍø www.paper51.com

       ÑÕÉ«:      

ÄÚÈÝÀ´×Ôwww.paper51.com

       <selectname="mycolor" style="font-size:12px">      

ÄÚÈÝÀ´×ÔÂÛÎÄÎÞÓÇÍø www.paper51.com

          <%If Request("mycolor")="#000000" Then %> copyright paper51.com

              <optionvalue="#000000" style="color:#000000" selected>ºÚÉ«</option>

ÄÚÈÝÀ´×ÔÂÛÎÄÎÞÓÇÍø www.paper51.com

          <%Else %>

http://www.paper51.com

              <optionvalue="#000000" style="color:#000000" >ºÚÉ«</option> paper51.com

          <%End If %>

http://www.paper51.com

          <%If Request("mycolor")="#FF0000" Then %> ÄÚÈÝÀ´×ÔÂÛÎÄÎÞÓÇÍø www.paper51.com

              <optionvalue="#FF0000" style="color:#FF0000" selected>ºìÉ«</option> copyright paper51.com

          <%Else %> http://www.paper51.com

              <optionvalue="#FF0000" style="color:#FF0000" >ºìÉ«</option> http://www.paper51.com

          <%End If %>

http://www.paper51.com

          <%If Request("mycolor")="#FFFF00" Then %>

paper51.com

              <optionvalue="#FFFF00" style="color:#FFFF00" selected>»ÆÉ«</option> ÄÚÈÝÀ´×Ôwww.paper51.com

          <%Else %>

paper51.com

              <optionvalue="#FFFF00" style="color:#FFFF00" >»ÆÉ«</option>

http://www.paper51.com

          <%End If %>

paper51.com

          <%If Request("mycolor")="#3333FF" Then %>

ÄÚÈÝÀ´×Ôwww.paper51.com

          copyright paper51.com

   <optionvalue="#3333FF" style="color:#3333FF" selected>À¶É«</option>

copyright paper51.com

          <%Else %> ÄÚÈÝÀ´×Ôwww.paper51.com

              <optionvalue="#3333FF" style="color:#3333FF" >À¶É«</option> paper51.com

          <%End If %>

copyright paper51.com

       </select>     

ÄÚÈÝÀ´×ÔÂÛÎÄÎÞÓÇÍø www.paper51.com

       ±íÇé:      

copyright paper51.com

       <selectname="myemote" style="font-size:12px">      

ÄÚÈÝÀ´×Ôwww.paper51.com

          <optionvalue="ÎÞ" selected>ÎÞ  

paper51.com

          <optionvalue="¿ªÐÄ">¿ªÐÄ  

http://www.paper51.com

          <optionvalue="ÓÇÉË">ÓÇÉË  

paper51.com

          <optionvalue="¿Þ">¿Þ   http://www.paper51.com

          <optionvalue="΢Ц">΢Ц  

paper51.com

          <optionvalue="»³ÒÉ">»³ÒÉ   copyright paper51.com

       </select> http://www.paper51.com

       &nbsp&nbsp&nbsp&nbsp&nbsp ÄÚÈÝÀ´×Ôwww.paper51.com

       <ahref="exit.asp" target="_top">À뿪ÁÄÌìÊÒ</a>  copyright paper51.com

   </form>

ÄÚÈÝÀ´×Ôwww.paper51.com

   <%

copyright paper51.com

   IFRequest("say")<>"" Then copyright paper51.com

       Dimsay,mycolor,myemote,user_name    

http://www.paper51.com

       user_name=Session("user_name")              

copyright paper51.com

       say=Server.HtmlEncode(Request("say"))          paper51.com

       mycolor=Request("mycolor")                  paper51.com

       myemote=Request("myemote")                ÄÚÈÝÀ´×Ôwww.paper51.com

       Ifmyemote="ÎÞ" Then                      ÄÚÈÝÀ´×ÔÂÛÎÄÎÞÓÇÍø www.paper51.com

        

ÄÚÈÝÀ´×ÔÂÛÎÄÎÞÓÇÍø www.paper51.com

  myemote=""

copyright paper51.com

       End If copyright paper51.com

       Dim sayStr ÄÚÈÝÀ´×ÔÂÛÎÄÎÞÓÇÍø www.paper51.com

       sayStr="<small>"& user_name & Time & myemote & "˵£º</small>" ÄÚÈÝÀ´×ÔÂÛÎÄÎÞÓÇÍø www.paper51.com

       sayStr=sayStr& "<font color='" & mycolor & "'>"&  say &"</font>"

http://www.paper51.com

       Application.Lock                      paper51.com

       Application("show")=sayStr & "<br>" & Application("show") copyright paper51.com

       IfLen(Application("show"))>10000 Then paper51.com

          Application("show")=Mid(Application("show"),1,10000)

ÄÚÈÝÀ´×ÔÂÛÎÄÎÞÓÇÍø www.paper51.com

       End If copyright paper51.com

       Application.Unlock                 

copyright paper51.com

   End If ÄÚÈÝÀ´×ÔÂÛÎÄÎÞÓÇÍø www.paper51.com

   %>

ÄÚÈÝÀ´×ÔÂÛÎÄÎÞÓÇÍø www.paper51.com

</body> copyright paper51.com

</html>

paper51.com

ÏÔʾÁÄÌìÐÅÏ¢Îļþmain.asp

ÄÚÈÝÀ´×Ôwww.paper51.com

Õâ¸öÎļþºÜ¼òµ¥,¾ÍÊǽ«applicationÖеÄÐÅϢд³öÀ´¡£Ò³Ãæÿ¸ô5Ãë×Ô¶¯¿ØÖÆË¢ÐÂÒ»´Î£¬³ÌÐòÈçÏ£º copyright paper51.com

<%

ÄÚÈÝÀ´×ÔÂÛÎÄÎÞÓÇÍø www.paper51.com

   Response.WriteApplication("show")                  

paper51.com

%> copyright paper51.com

5.2.2ÁôÑÔ°åµÄÉè¼Æ

paper51.com

add.asp---Ìí¼ÓÁôÑÔ

ÄÚÈÝÀ´×ÔÂÛÎÄÎÞÓÇÍø www.paper51.com

delete.asp-ɾ³ýÁôÑÔ

ÄÚÈÝÀ´×ÔÂÛÎÄÎÞÓÇÍø www.paper51.com

lyb.asp---ÁôÑÔ°åÖ÷Ò³

paper51.com

ÁôÑÔ°åÖ÷Ò³³ÌÐòÖ÷Òª¼ÓÁ˸ö·ÖÒ³ÏÔʾ ÄÚÈÝÀ´×ÔÂÛÎÄÎÞÓÇÍø www.paper51.com

Ìí¼ÓÁôÑÔ³ÌÐòÈçÏ£º ÄÚÈÝÀ´×Ôwww.paper51.com

<% option explicit%> copyright paper51.com

<%Response.Buffer=True%> ÄÚÈÝÀ´×ÔÂÛÎÄÎÞÓÇÍø www.paper51.com

<%

copyright paper51.com

dim db

paper51.com

set db=server.CreateObject("adodb.connection")

http://www.paper51.com

db.Open "driver={microsoft Access driver(*.mdb)};dbq=" &server.MapPath(".../data/yhzc.mdb")

ÄÚÈÝÀ´×ÔÂÛÎÄÎÞÓÇÍø www.paper51.com

%>

paper51.com

   <% ÄÚÈÝÀ´×ÔÂÛÎÄÎÞÓÇÍø www.paper51.com

   Dimtitle,body,name,email                   

copyright paper51.com

   title=Request.Form("title")                  paper51.com

   body=Request.Form("body")                

paper51.com

   name=Request.Form("name")               

copyright paper51.com

   email=Request.Form("email")               

ÄÚÈÝÀ´×ÔÂÛÎÄÎÞÓÇÍø www.paper51.com

   DimSql,sValues

http://www.paper51.com

   Sql ="Insert Into guest(name"

paper51.com

   sValues ="Values('" & name & "'"

paper51.com

   Sql = Sql& ",title" ÄÚÈÝÀ´×ÔÂÛÎÄÎÞÓÇÍø www.paper51.com

   sValues = sValues& ",'" & title & "'" http://www.paper51.com

   Ifbody<>"" Then                          copyright paper51.com

       Sql= Sql & ",body"

ÄÚÈÝÀ´×Ôwww.paper51.com

       sValues= sValues & ",'" & body & "'"

paper51.com

   End If copyright paper51.com

   Ifemail<>"" Then                        ÄÚÈÝÀ´×Ôwww.paper51.com

       Sql= Sql & ",email"

ÄÚÈÝÀ´×Ôwww.paper51.com

       sValues= sValues & ",'" & email & "'"

ÄÚÈÝÀ´×ÔÂÛÎÄÎÞÓÇÍø www.paper51.com

   copyright paper51.com

End If ÄÚÈÝÀ´×Ôwww.paper51.com

   Sql = Sql& ",submit_date" http://www.paper51.com

   sValues =sValues & ",'" & date & "'"           http://www.paper51.com

   Sql = Sql& ") " & sValues & ")" paper51.com

   db.Execute(Sql)                            copyright paper51.com

   db.Close                                 http://www.paper51.com

   Response.Redirect"lyb.asp"                http://www.paper51.com

  %>

copyright paper51.com

ɾ³ýÁôÑÔ³ÌÐòÈçÏ£º paper51.com

<% option explicit%>

ÄÚÈÝÀ´×Ôwww.paper51.com

<%Response.Buffer=True%> paper51.com

<% ÄÚÈÝÀ´×Ôwww.paper51.com

dim db copyright paper51.com

set db=server.CreateObject("adodb.connection") ÄÚÈÝÀ´×Ôwww.paper51.com

db.Open "driver={microsoft Access driver(*.mdb)};dbq=" &server.MapPath(".../data/yhzc.mdb") ÄÚÈÝÀ´×ÔÂÛÎÄÎÞÓÇÍø www.paper51.com

%>

ÄÚÈÝÀ´×ÔÂÛÎÄÎÞÓÇÍø www.paper51.com

<html>

ÄÚÈÝÀ´×Ôwww.paper51.com

<head> ÄÚÈÝÀ´×Ôwww.paper51.com

   <title>ɾ³ýÁôÑÔ</title> http://www.paper51.com

</head> ÄÚÈÝÀ´×Ôwww.paper51.com

<body>

copyright paper51.com

   <% paper51.com

        Dim sql,guest_id paper51.com

       guest_id=Request.QueryString("guest_id")         

paper51.com

       sql="DeleteFrom guest Where guest_id =" & guest_id paper51.com

       db.Execute(sql)                               

ÄÚÈÝÀ´×ÔÂÛÎÄÎÞÓÇÍø www.paper51.com

      

paper51.com

db.Close                                       paper51.com

       Response.Redirect  "lyb.asp"                    

ÄÚÈÝÀ´×ÔÂÛÎÄÎÞÓÇÍø www.paper51.com

   %> paper51.com

</body>

ÄÚÈÝÀ´×Ôwww.paper51.com

</html> http://www.paper51.com

------·Ö¸ôÏß----------------------------
ÁªÏµ·½Ê½