getTableData 函数|显示查询数据
public string getTableData(DataTable dt, string Model, params string[] columns)
{
System.Text.StringBuilder tempSb = new System.Text.StringBuilder("");
if (dt != null)
{
foreach (DataRow dr in dt.Rows)
{
string[] tempStr = new string[columns.Length];
for (int i = 0; i < tempStr.Length; i++)
{
tempStr[i] = Convert.ToString(dr[columns[i]]);
}
tempSb.AppendFormat(Model, tempStr);
}
}
return tempSb.ToString();
}
/// <summary>
/// 功能函数获取没有空值的函数
/// </summary>
/// <param name="str"></param>
/// <returns></returns>
public string GetNoNullString(string str)
{
str = string.IsNullOrEmpty(str) ? ("") : (str);
return str;
}
posted on 2009-06-05 15:10
sanmao 阅读(642)
评论(0) 编辑 收藏