<form id="hz9zz"></form>
  • <form id="hz9zz"></form>

      <nobr id="hz9zz"></nobr>

      <form id="hz9zz"></form>

    1. 明輝手游網中心:是一個免費提供流行視頻軟件教程、在線學習分享的學習平臺!

      ASP.NET多語言支持

      [摘要]2000-12-12· crystal譯 ·yesky   asp.net支持多種語言,它的缺省語言將是:visual basic而不是vbscript,這意味著我們可以擺脫vb...
      2000-12-12· crystal譯 ·yesky

        asp.net支持多種語言,它的缺省語言將是:visual basic而不是vbscript,這意味著我們可以擺脫vbscript的語言限
      制,我們的代碼將是編譯后運行的(而不是原來的解釋執行)。

        Visual Basic

        讓VBScript 一邊去吧。ASP現在全部用成熟的VB語言來書寫。感覺還不錯,不是嗎?不過,VB有了一些改動。VB中的
      主要改變,不再有Set & Let,不再有缺省屬性,Parenthesis現在被稱為SUBS,Arguments需通過缺省設置來實現
      BYVAL,Integer 為32位,Long為64位,And" and "Or“ 省略了,通過上面的清單不難發現,VB的許多變動是有實際意義的,
      也是有明顯進步的。

        不過,通過上面這些變動卻不能改變一個事實,你許多現有的代碼將不會正常運作。

        我們先看個完整的查詢的例子,這個例子也顯示了當查詢顯示沒有紀錄返回和如何檢測返回NULL數據的情況

        <%@ OutputCache duration="240"%>
      <%--
      the above OutputCache directive is pretty slick
      It means that for 240 seconds (4 minutes) the page will only read the database once
      only the first user hitting it forces a database read
      --%>
      <%@ Import Namespace="System.Data" %>
      <%@ Import Namespace="System.Data.ADO" %>

        <script language="VB" runat="server">
      Sub Page_Load(Src As Object, E As EventArgs)
        Dim DS As DataSet
        Dim MyConnection As ADOConnection
        Dim MyCommand As ADODataSetCommand
        dim strconn as string
        dim strSQL as string

        strconn="DSN=student;uid=student;pwd=magic;database=student"

        strSQL="select * from Publishers where state="NY""

        MyConnection = New ADOConnection(strconn)
        MyCommand = New ADODataSetCommand(strSQL,MyConnection)

        DS = new DataSet()
        MyCommand.FillDataSet(ds, "Publishers")

        MyDataGrid.DataSource=ds.Tables("Publishers").DefaultView
        MyDataGrid.DataBind()
      End Sub

      </script>
      <html><head>
      <title>Grid of New York Data</title>
      </head>
      <body bgcolor="#FFFFFF">
      <h3><font face="Verdana">New York Data</font></h3>

      <ASP:DataGrid id="MyDataGrid" runat="server"
      Width="100%"
      BackColor="white"
      BorderColor="black"
      ShowFooter="false"
      CellPadding=3
      CellSpacing="0"
      Font-Name="Verdana"
      Font-Size="8pt"
      Headerstyle-BackColor="lightblue"
      Headerstyle-Font-Size="10pt"
      Headerstyle-Font-Style="bold"
      MaintainState="false"
      />
      </body></html>

        C# (C Sharp)

        C # 非!翱帷,這兒有個雙關語,在微軟的內部代碼名稱里,C#就被稱為 “酷”(具體語法將另文介紹)。如果你
      是用VB的開發者,就沒有必要換用其它的語言,但是用C++ 的開發者會高興得不得了。我們將在后面看到關于C#的例子

        Jscript

        如我所知,這也是以前老版本的Jscript。如同VB一樣,Jscript也從NGWS runtime中得益不少,并且它也是被編譯過的。





      日韩精品一区二区三区高清