con.Open()
dtrSeekfor = cmdSelect.ExecuteReader( CommandBehavior.SingleRow ) If dtrSeekfor.Read Then
Dim stritem_name As String = dtrSeekfor( "item_name" ) End If
dtrSeekfor.Close()
con.Close()上一段代码是在page_load中的
我如何在<title></title>中显示这个变量item_name的值呢。

解决方案 »

  1.   

    <title><%=item_name %></title>
      

  2.   

    BC30451: 名称“stritem_name”未声明。
      

  3.   

    private void page_load(...,...)
    {
      Response.Write("<title>+item_name+</title>");
    //加这句代码,这是C#,你用VB.Net改一下就行了。反正就是用vb.net来输出小括号中的字符串。
    }
      

  4.   

    http://community.csdn.net/Expert/topic/3377/3377938.xml?temp=.3974573
      

  5.   

    title上面还一段html的,我还要用Response.Write写啊?
      

  6.   

    定义一个public  变量 在你的webForm 数据声明段
     public string item_name = "" ; // alternatively,you can specify a default value;---------------然后你的代码改为
    con.Open()
    dtrSeekfor = cmdSelect.ExecuteReader( CommandBehavior.SingleRow ) If dtrSeekfor.Read Then
    item_name = dtrSeekfor( "item_name" )  ''' note the changes
    End If
    dtrSeekfor.Close()
    con.Close()----------- in the html code of the WebForm 
    <title><%=item_name %></title>