合并成Select的SQL语句
2015-11-25 16:39:57 访问(1440) 赞(0) 踩(0)
/// <summary>
/// 合并成Select的SQL语句
/// </summary>
/// <param name="sqlSelectResult"></param>
/// <param name="sqlFromResult"></param>
/// <param name="sqlWhereResult"></param>
/// <param name="sqlOrderResult"></param>
/// <returns></returns>
public string ToSelectSQL
(
string sqlSelectResult,
string sqlFromResult,
string sqlWhereResult,
string sqlOrderResult
)
{
StringBuilder theResult = new StringBuilder();
theResult.Append("select ");
theResult.Append(sqlSelectResult);
theResult.Append(" from ");
theResult.Append(sqlFromResult);
if (sqlWhereResult != null && sqlWhereResult.Length > 0)
{
theResult.Append(" where ");
theResult.Append(sqlWhereResult);
}
if (sqlOrderResult != null && sqlOrderResult.Length > 0)
{
theResult.Append(" order by ");
theResult.Append(sqlOrderResult);
}
return theResult.ToString();
}
标签:
合并成Select的SQL语句 


上一条:
下一条:
相关评论
发表评论