:指定參數
代碼如下:
public DataTable TodayToTable(int userId)
{
return userId > 0 ? V_CN_TASK_VALID_SCORING_TODAY.QueryTable(condition: " WHERE 承接者Id = " + userId) : null;
}
其中的condition: " WHERE 承接者Id = " + userId就是指定參數 condition是QueryTable方法的參數
代碼如下:
/// <summary>
/// 查詢指定表的記錄
/// </summary>
/// <param name="table">表名</param>
/// <param name="fields">SELECT 子句的字段名列表</param>
/// <param name="condition">查詢條件</param>
/// <param name="args">以半角逗號分隔的命令參數名稱列表</param>
/// <param name="vals">命令參數值數組(可選)</param>
/// <returns>查詢結果</returns>
public static DataTable QueryTable(this string table, string fields = null, int? limit = null, string condition = null, string args = null, params object[] vals)
{
return GetTable(table.QueryDataSet(fields, limit, condition, args, vals), 0);
}
??運算符
代碼如下:
var m_queryFields = fields.TrimNull() ?? "*";
等於
代碼如下:
var m_queryFields = fields.TrimNull() ? "*":fields.TrimNull();