:指定參數
複製代碼 代碼如下: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();