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