greenapple.Connectoperations.update C# (CSharp) Метод

update() публичный Метод

updates the database
public update ( string table, string attributes, string values, string where ) : int
table string the table being updated
attributes string the attributes to update
values string the values that correspond to the attributes
where string the clause to be used eg' where id=1'
Результат int
        public int update(string table,string attributes, string values,string where)
        {
            string statement = "";
              string[] _attributes = attributes.Split(',');
              string[] _values = values.Split(',');
              string delimer = ",";

              if (_attributes.Length != _values.Length)
              {
              MessageBox.Show("Attributes and Values Must Match!");
              }
              else
              {
              for (int i = 0; i < _attributes.Length; i++)
              {
                  if (i == _attributes.Length - 1)
                  {
                      delimer = "";
                  }
               statement +=(_attributes[i]+"="+_values[i]+delimer);
              }
              }
              statement +=" "+ where;
              return mycon.nonqry("UPDATE " + table +" SET "+ statement);
        }