隨筆 - 20  文章 - 7  trackbacks - 0
          <2025年7月>
          293012345
          6789101112
          13141516171819
          20212223242526
          272829303112
          3456789

          常用鏈接

          留言簿(1)

          隨筆檔案

          文章分類

          文章檔案

          積分與排名

          • 積分 - 20431
          • 排名 - 1710

          最新評論

          一種我未用過的方法,但現在覺得很爽

           1<%@language=vbscript codepage=936 %>
           2<%
           3option explicit
           4response.buffer=true    
           5dim conn
           6dim connstr
           7dim db
           8db="yipinjia.asp"
           9Set conn = Server.CreateObject("ADODB.Connection")
          10connstr="Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & Server.MapPath(""&db&"")
          11conn.Open connstr
          12
          13%>
          14
          15<%
          16Rem 判斷發言是否來自外部
          17function ChkPost()
          18    dim server_v1,server_v2
          19    chkpost=false
          20    server_v1=Cstr(Request.ServerVariables("HTTP_REFERER"))
          21    server_v2=Cstr(Request.ServerVariables("SERVER_NAME"))
          22    if mid(server_v1,8,len(server_v2))<>server_v2 then
          23        chkpost=false
          24    else
          25        chkpost=true
          26    end if
          27end function

          28%>
          posted @ 2006-03-16 00:34 The Game, tomtom 閱讀(228) | 評論 (0)編輯 收藏

             在實現頁面跳轉的時候,有些人喜歡用Response.Redirect,而有些人則喜歡用Server.Transfer。大部分時間似乎這兩種方法都可以實現相同的功能,那究竟有區別嗎?

                  查了些文檔,發現兩者區別還是很明顯的。根本上,Response是叫瀏覽器去重新轉向到指定的網頁,而Server自然是發生在服務器端為主了,因此會有以下區別:
          1. Server.Transfer只能夠轉跳到本地虛擬目錄指定的頁面,而Response.Redirect則十分靈活;
          2. Server.Transfer可以將頁面參數方便傳遞到指定頁面;
          3. 使用時,Server.Transfer跳到別的頁面后,瀏覽器顯示的地址不會改變,有時反而會造成誤會,當然也有些場合需要這樣的效果;
          4. Server.Transfer可以減少客戶端對服務器的請求;

          posted @ 2006-03-11 12:12 The Game, tomtom 閱讀(198) | 評論 (0)編輯 收藏
          安裝asp.net環境,首先先安裝IIS.

            一 IIS安裝方法:
            1.選擇"控制面板".

            2.點"添加刪除軟件".

            3.選擇"添加組件",把系統盤放的光驅中.

            4.選中IIS點下一步就可以了.

            5.在瀏覽器中輸入" http://localhost "測試IIS是否安裝成功.

            到這步你可以把你的asp網頁放到系統盤(一般是C盤,我的是F盤)的C:\Inetpub\wwwroot的文件夾中了。

            比如你你C:\Inetpub\wwwroot中建了一個ip363,在瀏覽器中輸入 http://localhost/ip363 就可以了.

            二 配置asp.net環境:

            下載mdac安裝:

            直接下載2.8中文版:
            http://download.microsoft.com/download/8/b/6/8b6198c0-fe96-4811-9d81-d5c76dd5fea8/MDAC_TYP.EXE

            然后下載.NET Framework 1.1版可再發行組件包
            http://download.microsoft.com/download/7/b/9/7b90644d-1af0-42b9-b76d-a2770319a568/dotnetfx.exe

            然后下載.NET Framework SDK1.1安裝
            下載1.1簡體中文版:
            http://download.microsoft.com/download/0/f/e/0fecf85c-fb50-4ca9-adf2-c4be7ec9b454/setup.exe

            最后安裝簡體中文語言包
            http://download.microsoft.com/download/4/b/c/4bce2f4b-548e-4e36-a3f7-46d79a6abd39/langpack.exe

            如果你沒法運行msi文件,請安裝以下軟件
            http://www.microsoft.com/downloads/details.aspx?displaylang=en&;FamilyID=4B6140F9-2D36-4977-8FA1-6F8A0F5DCA8F
           
            最后如果在程序那里看到 Microsoft .NET Framework SDK 就安裝完成了.

            也可以安裝Microsoft VS.NET 這樣寫asp.net代碼就簡單方便了

          posted @ 2006-02-14 16:40 The Game, tomtom 閱讀(251) | 評論 (0)編輯 收藏
          1<%@ page language="vb" %>
          2<h1>使用Choose函數簡化SelectCase語句</h1>
          3<%
          4Dim intA as integer=2, strTemps as string
          5strTemps=Choose(intA,"","","","","")
          6response.write("intA的值是" & intA & "時,結果為"&strTemps)
          7%>




          Choose函數語法:  Choose(數值變量,返回值1,返回值2,返回值3,......)      注意intA一定要是數值變量!


          response.write()里面如果是字符串或html語句,要加上"",是變量則加上&,  句中strTemps在右側則只需加一個&
          posted @ 2006-02-08 16:20 The Game, tomtom 閱讀(821) | 評論 (0)編輯 收藏
          1<%@ page language="vb" %>
          2<h1>使用Iif()函數簡化IfThen語句</h1>
          3<%
          4Dim intA As integer=11, strTemps As String
          5strTemps=Iif(intA>10,"intA變量的值大于10","變量的值小于10")
          6response.write(strTemps)
          7%>




          Iif函數語法: Iif(條件式,語句1,語句2)
               語句1:當條件式運算結果為True值的表達式或變量內容
               語句2:當條件式運算結果為False值的表達式或變量內容


          respose.write()里面可以直接寫變量的名
          posted @ 2006-02-08 15:55 The Game, tomtom 閱讀(444) | 評論 (0)編輯 收藏

           

           1<body>
           2<h1>獲得數組維數的最大索引值</h1>
           3<%
           4dim arrayA(10as integer
           5response.write("獲取一維數組的最大索引值,結果為" & ubound(arrayA) & "<br>")
           6dim arrayB(15,20as integer
           7response.write("獲取二維數組第一維度的最大索引值,結果為"& ubound(arrayB,1&"<br>")
           8response.write("獲取二維數組第二維度的最大索引值,結果為"& ubound(arrayB,2)&"<br>")
           9%>
          10</body>








          Dim ArrayA as integer() = (1,2,3,4,5)
          相當于聲明一個ArrayA(4)的一維數組

          posted @ 2006-02-06 20:44 The Game, tomtom 閱讀(655) | 評論 (0)編輯 收藏
          本人在 http://www.goofar.com 注冊了一個免費asp.net空間,10M的,還算不錯.
          只是每天只允許200個用戶注冊,大家耐心點試咯.
          posted @ 2006-02-05 22:01 The Game, tomtom 閱讀(557) | 評論 (2)編輯 收藏

          <%@ page language="vb" %>
          <html>
          <head>
          <title>
          vb.net操作符號綜合范例
          </title>
          </head>
          <body>
          <%
          dim intA as integer = 10, intB as integer = 5, intC as integer = 3
          dim strA as string = "ASP.NET", strB as string = "VB.NET"
          dim blnA as boolean = true, blnB as boolean = false
          response.write(
          "條件設置:<br>")
          response.write(
          "整數條件: intA=" & intA & ",intB=" & intB & ",intC=" & intC & """<br>")
          response.write(
          "字符串條件: strA=""" & strA & """,strB=""" & strB & """<br>")
          response.write(
          "布爾代數:blnA=" & blnA & "blnB=" & blnB & "<br><b>")
          response.write(
          "括號優先級:")
          response.write(
          "(intA - intB)*intC結果為:"&((intA-intB)*intC)&"<br>")
          response.write(
          "算數操作符:")
          response.write(
          "intA-intB*intC結果為:"&(intA-intB*intC)&",<br>")
          response.write(
          "比較操作符:")
          response.write(
          "intA>intB的結果為:" &(intA>intB)& ",")
          response.write(
          "strA<>strB的結果為 " & (strA<>strB)& "<br>")
          response.write(
          "邏輯操作符:")
          response.write(
          "blnA and blnB的結果為" & (blnA and blnB) & ",")
          response.write(
          "blnA or blnB的結果為" & (blnA or blnB) & "<br>")

          %
          >
          </body>
          </html>
          posted @ 2006-02-05 21:36 The Game, tomtom 閱讀(686) | 評論 (1)編輯 收藏
           1<% @page language="vb" %>
           2<html>
           3<head>
           4<title>
           5編寫一個asp.net程序代碼
           6</title>
           7</head>
           8<body>
           9<%
          10dim strAuthorName
          11dim intDefaultSize as integer
          12dim strFontName as string="隸書"
          13const strTitle as string="編寫""一個""asp.net程序"
          14const strFontColor as string="purple"
          15strAuthorName=10
          16strAuthorName="tomtom"
          17intDefaultSize= 5
          18response.write("<font face=" & strFontName & " size=" & intDefaultSize & " color=" & strFontColor & ">")'這里的"和&之間一定要有一個空格!!!我不加空格的話就調試不到,不知道為什么,有沒有高手可以告訴我?
          19response.write("標題文字:" & strTitle & "<br>")
          20response.write("作者:" & strAuthorName & "<br>")
          21response.write("默認中文字體:" & strFontName & "<br>")
          22response.write("默認字號:" & intDefaultSize & "<br>")
          23response.write("</font>")
          24%>
          25</body>
          26</html>






          posted @ 2006-02-05 21:36 The Game, tomtom 閱讀(245) | 評論 (1)編輯 收藏

           

          <% @ page language="VB" %>
          <html>
          <head>
          <title>
          我的第一個asp.net程序代碼
          </title>
          </head>
          <body>
          <%
          Dim i as integer
          For i = 1 to 5 %>
          <font size= <=i %>>我的第一個asp.net程序代碼<br></font>
          <%
          Next
          Response.write(
          "編寫第一個asp.net程序!")
          %
          >

          </body>
          </html>
          <font size=<%=i%>>我的第一個asp程序</br></font>

          posted @ 2006-02-05 21:35 The Game, tomtom 閱讀(176) | 評論 (0)編輯 收藏
          僅列出標題
          共2頁: 上一頁 1 2 
          主站蜘蛛池模板: 鸡泽县| 满洲里市| 商南县| 广安市| 利川市| 图们市| 南皮县| 沾化县| 莎车县| 永清县| 登封市| 昭平县| 新津县| 剑川县| 堆龙德庆县| 永嘉县| 清新县| 太康县| 寿光市| 霍林郭勒市| 乐平市| 新乐市| 乌兰县| 九江市| 榆树市| 平乐县| 公主岭市| 墨竹工卡县| 修文县| 汤原县| 肇庆市| 兴和县| 台山市| 鹤壁市| 临武县| 汉沽区| 阿拉善左旗| 安徽省| 长汀县| 武城县| 枣庄市|