日期:2014-05-18 浏览次数:20386 次
DataSet ds = 数据集; if (ds.Tables.Count > 0) { DataTable dt=dt = ds.Tables[0]; if (dt.Rows.Count > 0) { txtbox.Text = dt.Rows[0]["xxx"].ToString().Trim(); } }
------解决方案--------------------
DataSet ds = 数据集;
if (ds.Tables.Count > 0)
{
DataTable dt=dt = ds.Tables[0];
if (dt.Rows.Count > 0)
{
for (int i= 0;i< dt.Rows.Count;i++)
{
txtbox.Text = dt.Rows[i]["字段名"].ToString().Trim();
}
}
}
------解决方案--------------------
public string HotSerchHTML() { DataTable DTHotSerchHTML = .........; StringBuilder strHotSerchHTML = new StringBuilder(); if (DTHotSerchHTML.Rows.Count > 0) { for (int i = 0; i < DTHotSerchHTML.Rows.Count; i++) { DataRow dr = DTHotSerchHTML.Rows[i]; strHotSerchHTML.Append(" <li><span>" + (i + 1) + "</span> <a href=\"s_result.aspx?tagname=" + dr["Keyword"] + "&type=\">" + dr["Keyword"] + "</a> <em>(" + dr["SerchSize"] + ")</em> </li>"); } } return strHotSerchHTML.ToString(); }
------解决方案--------------------
DataSet ds = 数据集;
if (ds.Tables.Count > 0)
{
DataTable dt=dt = ds.Tables[0];
if (dt.Rows.Count > 0)
{
for (int i= 0;i< dt.Rows.Count;i++)
{
txtbox.Text = dt.Rows[i]["字段名"].ToString().Trim();