הוסטס - פורום אחסון האתרים הגדול בישראל

הוסטס - פורום אחסון האתרים הגדול בישראל (https://hosts.co.il/forums/index.php)
-   פורום תיכנות (https://hosts.co.il/forums/forumdisplay.php?f=14)
-   -   בעיות בקוד ASP.net (https://hosts.co.il/forums/showthread.php?t=26222)

בניה 12-07-06 16:00

בעיות בקוד ASP.net
 
ב"ה


יש לי את הקוד דוגמא הזה:
קוד:

<%@ Import Namespace="System.Data" %>
<%@ Import Namespace="System.Data.ADO" %>
<html>
<script language="VB" runat="server">
    sub Page_Load(obj as Object, e as EventArgs)

        'set up connection
        dim myConnection as ADOConnection = new ADOConnection _
                    ("Provider=Microsoft.Jet.OLEDB.4.0;" & _
                      "Data Source=D:\Bnaya\59347\banking.mdb")

        'open connection
        dim myCommand as ADODataSetCommand = new ADODataSetCommand _
                            ("SELECT * FROM tblUsers", myConnection)

        'fill dataset
        dim ds as DataSet = new DataSet()
        myCommand.FillDataSet(ds, "tblUsers")

        'select data view and bind to server control
        MyDataList.DataSource = ds.Tables("tblUsers"). _
                                                                DefaultView
        MyDataList.DataBind()
    end sub
</script>

<body topmargin="0" leftmargin="0" marginwidth="0" marginheight="0">

  <asp:DataList id="MyDataList" RepeatColumns="2" RepeatDirection=
                                        "Vertical" runat="server">
      <%# DataBinder.Eval(Container.DataItem, "FirstName") %>&nbsp;
            <%# DataBinder.Eval(Container.DataItem, "LastName") %>
            </i></b>
          </div>
          <br />

          <b>Address: </b><%# DataBinder.Eval(Container.DataItem, _
                                              "Address") %><br />
          <b>City: </b><%# DataBinder.Eval(Container.DataItem, _
                                                    "City") %><br />
          <b>State: </b><%# DataBinder.Eval _
                            (Container.DataItem, "State") %><br />
          <b>ZIP: </b><%# DataBinder.Eval _
                            (Container.DataItem, "Zip") %><br />
          <b>Phone: </b><%# DataBinder.Eval _
                            (Container.DataItem, "Phone") %><br />
          </div>
      </template>
  </asp:DataList>

</body>
</html>

אני מריץ אותו על שרת שתומך בasp.net 2 ומקבל את השגיאה:
קוד:

Parser Error Message: Code blocks are not supported in this context.
האם יתכן שזה נובע מהבדלי גירסאות ASP.net?


כל הזמנים הם GMT +2. הזמן כעת הוא 02:47.

מופעל באמצעות VBulletin גרסה 3.8.6
כל הזכויות שמורות ©
כל הזכויות שמורות לסולל יבוא ורשתות (1997) בע"מ