public String getUpdateParmSQL(String cWhereParm) { StringBuilder ValueList = new StringBuilder(); for (int i = 0; i < FieldList.Count; i++) { JActiveField aField = FieldList[i]; String cFieldName = aField.FieldName; String cFieldValue = aField.FieldValue; if (String.IsNullOrWhiteSpace(cFieldValue)) { cFieldValue = null; } else { cFieldValue = "'" + cFieldValue + "'"; } if (i == 0) { ValueList.Append(cFieldName + "=@" + cFieldName.ToLower()); ParmList.Add(cFieldValue); } else { ValueList.Append("," + cFieldName + "=@" + cFieldName.ToLower()); ParmList.Add(cFieldValue); } } return("UPDATE " + TableName + " SET " + ValueList + " WHERE " + cWhereParm); }
public String getInsertParmSQL() { StringBuilder sbFieldList = new StringBuilder(); StringBuilder sbValueList = new StringBuilder(); for (int i = 0; i < FieldList.Count; i++) { JActiveField aField = FieldList[i]; String cFieldName = aField.FieldName; String cFieldValue = aField.FieldValue; if (String.IsNullOrWhiteSpace(cFieldValue)) { continue; } if (sbFieldList.Length == 0) { sbFieldList.Append(cFieldName); sbValueList.Append(" @" + cFieldName + ""); ParmList.Add(cFieldValue); } else { sbFieldList.Append("," + cFieldName + ""); sbValueList.Append(" @" + cFieldName + ""); ParmList.Add(cFieldValue); } } return("INSERT INTO " + TableName + "(" + sbFieldList + ") VALUES(" + sbValueList + ")"); }
public int Find(String cFieldName) { int idx = -1; for (int i = 0; i < FieldList.Count; i++) { JActiveField aField = FieldList[i]; if (cFieldName.ToLower().Equals(aField.FieldName.ToLower())) { idx = i; break; } } return(idx); }
public int AddField(String cFieldName, double dVal) { int idx = Find(cFieldName); if (idx == -1) { JActiveField vField = new JActiveField(cFieldName, dVal); FieldList.Add(vField); return(FieldList.Count - 1); } else { return(idx); } }
public int AddField(JActiveField vField) { int idx = Find(vField.FieldName); if (idx == -1) { FieldList.Add(vField); return(FieldList.Count - 1); } else { FieldList[idx] = vField; return(idx); } }
public int AddField(String cFieldName, int iVal) { int idx = Find(cFieldName); if (idx == -1) { JActiveField vField = new JActiveField(cFieldName, iVal); FieldList.Add(vField); return(FieldList.Count - 1); } else { FieldList[idx].FieldValue = StringEx.getString(iVal); return(idx); } }