public void setParameter(string Name, object Value, Schema.fieldType FieldType, Schema.inoutType InOut, int Size = 0) { string val = String.Empty; if (Value != null) val = Value.ToString(); else { // default values switch (FieldType) { case fieldType.@decimal: case fieldType.@int: val = "0"; break; case fieldType.json: case fieldType.tryjson: val = "{}"; break; case fieldType.text: val = ""; break; default: var msg = String.Format("Value missing for parameter: {0}", Name); throw new Exception(msg); } } var q = _query.parameters.parameter.FirstOrDefault(p => { return p.name == Name; }); if (q != null) { q.Text = new List<string>(); q.Text.Add(val); if(Size != 0) { q.size = Size; q.sizeSpecified = true; } } else { if(Size != 0) _query.AddParameter(Name, val, FieldType, InOut, Size); else _query.AddParameter(Name, val, FieldType, InOut); } }
public void setParameter(string Name, object Value, Schema.fieldType FieldType, Schema.inoutType InOut) { setParameter(Name, Value, FieldType, InOut, 0); }