当前位置:编程学习 > C#/ASP.NET >>

asp.net出现:未声明名称“__o”

首先代码如下:

<%
           '创建数据库连接
              Dim strConn As String
              strConn = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & Server.MapPath("/data/#51cms.mdb")
              Dim OleDbConn As OleDbConnection
              OleDbConn = New OleDbConnection(strConn)

      Dim strCmd As String = "select id,title,typelevel,listid from NewsType order by listid"

              OleDbConn.Open()
      Dim DA = New OleDbDataAdapter(strCmd, OleDbConn)  '创建一个OleDbDataAdapter对象
      Dim DS = New DataSet()                            '定义DataSet对象
      DA.Fill(DS, "NewsType")                                      '利用Fill 方法填充DataSet对象
      OleDbConn.Close()
      OleDbConn.Dispose()
      
      Dim iCount, iCount1, i, j As Integer
  %>
<select name="F_id" class="dataInput" id="F_id">
                    <option value="" style="color:#663366;">--请选择类别--</option>
                    <%For iCount = 0 To DS.Tables("NewsType").Rows.Count - 1%>
                    <option <%If DS.Tables("NewsType").Rows(iCount)("TypeLevel") Mod 2 <> 0 Then
                    response.write ("style='color:#ff9900;'")
                    end if%> value="<%=DS.Tables(0).Rows(iCount)("TypeLevel")%>"><%
                                                                                     For i = 1 To DS.Tables("NewsType").Rows(iCount)("TypeLevel")
                                                                                         Response.Write("xx")
                                                                                     Next
                                                                                     %>├ <%Response.Write(DS.Tables("NewsType").Rows(iCount)("title"))%></option>
                    <%Next%>
                    <%For iCount1 = 0 To DS.Tables("NewsType").Rows.Count - 1%>
                    <option <%If DS.Tables("NewsType").Rows(iCount1)("TypeLevel") Mod 2 <> 0 Then
                    response.write ("style='color:#ff9900;'")
                    end if%> value="<%=DS.Tables(0).Rows(iCount1)("TypeLevel")%>"><%
                                                                                      For j = 1 To DS.Tables("NewsType").Rows(iCount1)("TypeLevel")
                                                                                          Response.Write("xx")
                                                                                      Next
                                                                                     %>├ <%Response.Write(DS.Tables("NewsType").Rows(iCount1)("title"))%></option>
                    <%Next%>
                  </select>

若我只写一个for next是正常的,但是我在加一个FOR next,则在最下面的:
<%
                                                                                      For j = 1 To DS.Tables("NewsType").Rows(iCount1)("TypeLevel")
                                                                                          Response.Write("xx")
                                                                                      Next
                                                                                     %>
这里提示
错误 1 未声明名称“__o”。 E:\公司网站\aspx\admin\xxx.aspx 70 83 杂项文件

大家帮下忙,不知为何会如此?

还有个问题,因为刚学。NET,页面框架是在DW里设计的,然后转到VS2005去的,但是好多如height=25px,要改成style="height:25px;",这样改非常不方便,有没有好的设计器,让他支持最新的XHTML 
否则有很多的错误或警告,如下:

2 验证 (XHTML 1.0 Transitional): 属性值必须用引号括起来。 E:\公司网站\aspx\admin\Admin_Admin.aspx 17 123 杂项文件
警告 26 验证 (XHTML 1.0 Transitional): 属性“bgcolor”被视为已过时。建议使用较新的构造。 E:\公司网站\aspx\admin\Admin_Admin.aspx 22 1 杂项文件
--------------------编程问答--------------------  <%For iCount = 0 To DS.Tables("NewsType").Rows.Count - 1%> 
                    <option <%If DS.Tables("NewsType").Rows(iCount)("TypeLevel") Mod 2 <> 0 Then 
                    response.write ("style='color:#ff9900;'") 
                    end if%> value=" <%=DS.Tables(0).Rows(iCount)("TypeLevel")%>"> <% 
                                                                                    For i = 1 To DS.Tables("NewsType").Rows(iCount)("TypeLevel") 
                                                                                        Response.Write("xx") 
                                                                                    Next 
                                                                                    %>├  <%Response.Write(DS.Tables("NewsType").Rows(iCount)("title"))%> </option> 
                    <%Next%> 
这样是正常的,但是
 <%For iCount = 0 To DS.Tables("NewsType").Rows.Count - 1%> 
                    <option <%If DS.Tables("NewsType").Rows(iCount)("TypeLevel") Mod 2 <> 0 Then 
                    response.write ("style='color:#ff9900;'") 
                    end if%> value=" <%=DS.Tables(0).Rows(iCount)("TypeLevel")%>"> <% 
                                                                                    For i = 1 To DS.Tables("NewsType").Rows(iCount)("TypeLevel") 
                                                                                        Response.Write("xx") 
                                                                                    Next 
                                                                                    %>├  <%Response.Write(DS.Tables("NewsType").Rows(iCount)("title"))%> </option> 
                    <%Next%> 

 <%For iCount = 0 To DS.Tables("NewsType").Rows.Count - 1%> 
                    <option <%If DS.Tables("NewsType").Rows(iCount)("TypeLevel") Mod 2 <> 0 Then 
                    response.write ("style='color:#ff9900;'") 
                    end if%> value=" <%=DS.Tables(0).Rows(iCount)("TypeLevel")%>"> <% 
                                                                                    For i = 1 To DS.Tables("NewsType").Rows(iCount)("TypeLevel") 
                                                                                        Response.Write("xx") 
                                                                                    Next 
                                                                                    %>├  <%Response.Write(DS.Tables("NewsType").Rows(iCount)("title"))%> </option> 
                    <%Next%> 
就出现未声明名称“__o”。 错误提示,是不是DATASET不可以用两次,还是什么原因啊,大家帮下我 --------------------编程问答-------------------- 结果能正确显示出来,就是VS2005里报错,也不能生成网站,什么原因啊 --------------------编程问答-------------------- 第二个改为最简的:
<%
                        For iCount1 = 0 To DS.Tables("NewsType").Rows.Count - 1
                            %>
                    <option value="xxx"><%=iCount1%></option>
                    <%
                    Next
                    %>

<%=iCount1%>出现波浪线,提示:错误 1 未声明名称“__o”。 E:\公司网站\aspx\admin\xxx.aspx 72 41 杂项文件
--------------------编程问答-------------------- 帮你顶 --------------------编程问答-------------------- 楼主还是先学会用asp.net的思路去编程吧

照这种asp的写法,又何必使用asp.net --------------------编程问答-------------------- 同意楼上!!!
补充:.NET技术 ,  ASP.NET
CopyRight © 2022 站长资源库 编程知识问答 zzzyk.com All Rights Reserved
部分文章来自网络,