<%= %>这种在debug下好像看不到,没试过,不过可以在它前后各放个":"之类的输出就知道了

解决方案 »

  1.   

    VS中,在theTitle 赋值语句处设置一个断点,看看会不会执行到那里,如果执行到了,直接就可以看它的值
      

  2.   

    可以设断点察看变量的值.也可以在客户端用alert(<%=theTitle %>)察看.
      

  3.   

    <%=theTitle %>后一语句上设置中断(F9),再调试(F5),运行后在theTitle上右键-->快速监控
      

  4.   

    <%=theTitle %>在前台代码中,没办法设断点啊,
      

  5.   

    我是在前台代码中加<script></script>中的,我也想把<script></script>中的代码放在后台页中,但是这样一来,前台代码中的<%=theTitle %>就报错没有声明,这怎么办呢?
      

  6.   

    那就
    response.write(theTitle)
    response.end
      

  7.   

    那你这个theTitle 总有定义和赋值吧,在那个赋值的地方设断点
      

  8.   

    我是定义在<script></script>中的:<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">  <script  Runat="Server">
          Dim theTitle As String
          Dim theContent As String
          Dim theAuthor As String
          Dim theCopyFrom As String
          Dim theAddTime As String
          Sub page_load(ByVal Sender As Object, ByVal E As EventArgs)
                        Dim Cnn As SqlConnection
              Dim Cmd As SqlCommand
              Dim DataR As SqlDataReader
              Dim StrCnn As String
             
              Dim codestr As String = Request.QueryString("id")
              Dim sql As String
              If Trim(codestr) <> "" Then
                  StrCnn = "server=localhost;uid=as;pwd=;database=myweb"
                  Cnn = New SqlConnection(StrCnn)
                  Cnn.Open()
                  sql = "select * from book_info where id=" & Trim(codestr)
                  Cmd = New SqlCommand(sql, Cnn)
                  DataR = Cmd.ExecuteReader
                  If DataR.Read() Then
                      theTitle = DataR("title")
                      theContent = DataR("content")
                      theAuthor = DataR("author")
                      theCopyFrom = DataR("copyfrom")
                      theAddTime = DataR("addtime")
                  Else
                      Cnn.Close()
                      Response.Write("<font color='gray'>请选择文章!</font>")
                      Response.End()
                  End If
                  Cnn.Close()
              End If
          End Sub
    </script>
    ----
    我设了断点,但没有执行page_load,这是为什么?
      

  9.   

    改成下面这样试试 :If Trim(codestr) <> "" Then
        StrCnn = "server=localhost;uid=as;pwd=;database=myweb"
        Cnn = New SqlConnection(StrCnn)
        Cnn.Open()
        sql = "select * from book_info where id=" & Trim(codestr)
        Cmd = New SqlCommand(sql, Cnn)
        DataR = Cmd.ExecuteReader
        If DataR.Read() Then
            theTitle = DataR("title")
      Response.Write("theTitle设置了值")
      Response.End()  
            theContent = DataR("content")
            theAuthor = DataR("author")
            theCopyFrom = DataR("copyfrom")
            theAddTime = DataR("addtime")
        Else
      Response.Write("theTitle没有设置值")
      Response.End()  
            Cnn.Close()
            Response.Write("<font color='gray'>请选择文章!</font>")
            Response.End()
        End If
        Cnn.Close()
    Else
      Response.Write("theTitle没有设置值")
      Response.End()  
    End If