public void Delete(DataCore dc, params string[] whereFieldArray) { try { _createTableOnDatabase(dc); sqlText = "DELETE FROM " + this.GetType().Name + " WHERE 1=1 "; if (whereFieldArray.Length == 0) { whereFieldArray = new string[1] { "IDFIELD" }; } foreach (string value in whereFieldArray) { sqlText += " AND " + value + "= @" + value; } _addParams(dc); dc.executeNonQuery(sqlText); } catch (Exception) { throw; } }
public void Update(DataCore dc,params string[] whereFieldArray) { try { _createTableOnDatabase(dc); sqlText = sqlBuilder.getUpdateScript(); if (whereFieldArray.Length == 0) { whereFieldArray = new string[1] { "IDFIELD" }; } foreach (string value in whereFieldArray) { sqlText += " AND " + value + "= @" + value; } _addParams(dc); dc.executeNonQuery(sqlText); } catch (Exception) { throw; } }
private void _createTableOnDatabase(DataCore dc) { try { sqlText = sqlBuilder.getTableCreateScript(); dc.executeNonQuery(sqlText); } catch (Exception) { throw; } }