应该是初级错误,BC30689: 语句不能出现在方法体外,见内
我要把表中的数据分行显示到table中,如下:
<script runat= "server ">
'Sub Page_Load(obj As object,e As eventargs)
Dim queryString As String = "select * from workflo2_bumen order by paixu "
Using connection As New OdbcConnection( "DSN=aa;uid=aa;pwd=** ")
Dim command As New OdbcCommand(queryString, connection)
connection.Open()
Dim reader As OdbcDataReader = command.ExecuteReader()
While reader.Read()
response.write(reader.getString(0)& " | "&reader.getString(1) & " <br> ")
response.Write( " <tr> ")
response.Write( " <td align= " "center " " nowrap style= " "border-bottom:1px dotted #8A9DC6;border-left:1px dotted #8A9DC6;border-right:1px dotted #8A9DC6 " "> <a href= " "huizhi.asp " "> <font color= " "#FFFFFF " "> reader.getString(1) </font> </a> </td> ")
response.Write( " <td align= " "right " " nowrap style= " "border-bottom:1px dotted #8A9DC6;border-right:1px dotted #8A9DC6 " "> </td> ")
response.Write( " <td align= " "right " " nowrap style= " "border-bottom:1px dotted #8A9DC6;border-right:1px dotted #8A9DC6 " "> </td> ")
response.Write( " <td align= " "right " " nowrap style= " "border-bottom:1px dotted #8A9DC6;border-right:1px dotted #8A9DC6 " "> </td> ")
response.Write( " <td align= " "right " " nowrap style= " "border-bottom:1px dotted #8A9DC6;border-right:1px dotted #8A9DC6 " "> </td> ")
response.Write( " <td align= " "right " " nowrap style= " "border-bottom:1px dotted #8A9DC6;border-right:1px dotted #8A9DC6 " "> </td> ")
response.Write( " <td align= " "right " " nowrap style= " "border-bottom:1px dotted #8A9DC6;border-right:1px dotted #8A9DC6 " "> </td> ")
response.Write( " <td align= " "right " " nowrap style= " "border-bottom:1px dotted #8A9DC6;border-right:1px dotted #8A9DC6 " "> </td> ")
response.Write( " </tr> ")
</script>
<tr>
<td align= "center " nowrap style= "border-bottom:1px dotted #8A9DC6;border-left:1px dotted #8A9DC6;border-right:1px dotted #8A9DC6 "> <a href= "huizhi.asp "> <font color= "#FFFFFF "> reader.getString(1) </font> </a> </td>
<td align= "right " nowrap style= "border-bottom:1px dotted #8A9DC6;border-right:1px dotted #8A9DC6 "> </td>
<td align= "right " nowrap style= "border-bottom:1px dotted #8A9DC6;border-right:1px dotted #8A9DC6 "> </td>
<td align= "right " nowrap style= "border-bottom:1px dotted #8A9DC6;border-right:1px dotted #8A9DC6 "> </td>
<td align= "right " nowrap style= "border-bottom:1px dotted #8A9DC6;border-right:1px dotted #8A9DC6 "> </td>
<td align= "right " nowrap style= "border-bottom:1px dotted #8A9DC6;border-right:1px dotted #8A9DC6 "> </td>
<td align= "right " nowrap style= "border-bottom:1px dotted #8A9DC6;border-right:1px dotted #8A9DC6 "> </td>
<td align= "right " nowrap style= "border-bottom:1px dotted #8A9DC6;border-right:1px dotted #8A9DC6 "> </td>
</tr>
<script runat= "server ">
End While
reader.Close()
End Using
'end sub
</script>
编译错误
说明: 在编译向该请求提供服务所需资源的过程中出现错误。请检查下列特定错误详细信息并适当地修改源代码。
编译器错误信息: BC30689: 语句不能出现在方法体外。
源错误:
行 212:Dim queryString As String = "select * from workflo2_bumen order by paixu "
行 213:
行 214: Using connection As New OdbcConnection( "DSN=aa;uid=aa;pwd=** ")
行 215: Dim command As New OdbcCommand(queryString, connection)
行 216: connection.Open()
源文件: D:\wwwroot\yuangongyingxiao8882\dc_default.aspx 行: 214
[解决办法]
取消对方法头和尾的注释。