时间:2021-07-01 10:21:17 帮助过:2人阅读
2、SQL实例化
1 private string CreateSQL(string sql, HttpRequest req) { 2 IList<string> list = new List<string>(); 3 if (sql.IndexOf(":%") > -1) 4 { 5 var mat = Regex.Matches(sql, "(?<=:%)[^%]+(?=%)"); 6 foreach (Match item in mat) 7 { 8 list.Add(item.Value); 9 } 10 foreach (var item in list) 11 { 12 sql = sql.Replace(":%" + item + "%", req[item]); 13 } 14 } 15 return sql; 16 }
3、查询数据并返回
1 using (var db = new OracleDB()) 2 { 3 return db.ExecuteDataTable(sql); 4 }
SQL模板和模板实例化
标签: