日期:2014-05-18 浏览次数:20488 次
public static string yj(string str,HtmlTableCell tt)
{
SqlConnection conn = new SqlConnection(ConfigurationManager.ConnectionStrings["GirlsysConnectionString"].ConnectionString);//连接数据库
try
{
conn.Open();
SqlCommand cmd = new SqlCommand(str, conn);
SqlDataReader dea = cmd.ExecuteReader();
while (dea.Read())
{
tt.InnerText +=" <a href=\"news_look.aspx?id=" + dea["id"] + "\" target=_blank>" + access.Substr(dea["title"].ToString(), 0, 11);
return tt.InnerText;
}
}
catch
{
return tt.InnerText;
}
finally
{
conn.Close();
}
}
------解决方案--------------------
public static string yj(string str,HtmlTableCell tt)
{
SqlConnection conn = new SqlConnection(ConfigurationManager.ConnectionStrings["GirlsysConnectionString"].ConnectionString);// 连接数据库
try
{
conn.Open();
SqlCommand cmd = new SqlCommand(str, conn);
SqlDataReader dea = cmd.ExecuteReader();
while (dea.Read())
{
tt.InnerText +=" <a href=\"news_look.aspx?id=" + dea["id"] + "\" target=_blank>" + access.Substr(dea["title"].ToString(), 0, 11);
}
return tt.InnerText;
}
catch
{
return tt.InnerText;
}