代码如下:
public static DataTable GetQueryTArticleinfo(int id)
{ SqlConnection Connection = new SqlConnection(ConnectionString); DataSet ds = new DataSet();
SqlCommand Cmd = new SqlCommand(); Cmd.Connection = Connection; Cmd.CommandText = "[dbo].[QueryTArticleinfo]"; Cmd.CommandType = CommandType.StoredProcedure; SqlParameter[] param ={
new SqlParameter("@id",SqlDbType.Int),
}; param[0].Value = id; AttachParameters(Cmd, param); SqlDataAdapter da = new SqlDataAdapter(Cmd); da.Fill(ds); foreach (DataRow row in ds.Tables[0].Rows)
{
string title = row["title"].ToString();
};
return ds.Tables[0];
}
如何在前台显示title里面的值咧,我的是这样的却没数据
经过调试之后。后台是有数据的
前台代码如下:
<meta name="description" content="<%$ appSettings:webdescription %>" />
<meta name="keywords" content="<%$ appSettings:webkeywords %>" />
<title><%=Title%></title>
<link href="/style/css.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="/Scripts/jquery-1.4.js"></script>
怎么样才能让它显示title的值
public static DataTable GetQueryTArticleinfo(int id)
{ SqlConnection Connection = new SqlConnection(ConnectionString); DataSet ds = new DataSet();
SqlCommand Cmd = new SqlCommand(); Cmd.Connection = Connection; Cmd.CommandText = "[dbo].[QueryTArticleinfo]"; Cmd.CommandType = CommandType.StoredProcedure; SqlParameter[] param ={
new SqlParameter("@id",SqlDbType.Int),
}; param[0].Value = id; AttachParameters(Cmd, param); SqlDataAdapter da = new SqlDataAdapter(Cmd); da.Fill(ds); foreach (DataRow row in ds.Tables[0].Rows)
{
string title = row["title"].ToString();
};
return ds.Tables[0];
}
如何在前台显示title里面的值咧,我的是这样的却没数据
经过调试之后。后台是有数据的
前台代码如下:
<meta name="description" content="<%$ appSettings:webdescription %>" />
<meta name="keywords" content="<%$ appSettings:webkeywords %>" />
<title><%=Title%></title>
<link href="/style/css.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="/Scripts/jquery-1.4.js"></script>
怎么样才能让它显示title的值
Response.Write("<title></title>");
4.0中可直接定义Page.MetaKeywords
HtmlHead head = (HtmlHead)Page.Header;
HtmlMeta meta = new HtmlMeta();
meta.Name = "";
meta.Content = "";
head.Controls.Add(meta); Page.Header.Title = "";<title>
<asp:Literal runat="server" ID="lTitle"></asp:Literal>
</title>
lTitle.text="";
后台:this.Page.Title=Title;就可以了。
后台:this.Page.Title=Title;就可以了。
这种不行列
title里面还可以放标签嘛,放到里面就报错了
<head>
title.InnerText="yourTitle";
</head>
<%=mytitle%></title>public string mytitle;
protected void Page_Load(object sender, EventArgs e)
{
mytitle =“这里是标题的字符串”;
}