Beispiel #1
0
        public bool Add(COperation item)
        {
            //try {
            //// https://ru.wikipedia.org/wiki/Insert_(SQL)
            //// ¬ыполнить команду Insrt и вернуть вставленный идентификатор в Sql http://qaru.site/questions/94594/execute-insert-command-and-return-inserted-id-in-sql

            SqlParameter[] parameters = new SqlParameter[] {
                new SqlParameter("@operator", item.action),
                new SqlParameter("@operand1", item.operand1),
                new SqlParameter("@operand2", item.operand2),
            };

            int modified = _bd.ExecuteNonQuery("INSERT INTO [dbo].[WebCalc](operator,operand1,operand2) VALUES(@operator,@operand1,@operand2)",
                                               CommandType.Text, parameters);

            return(1 == modified);
        }
Beispiel #2
0
 public bool Add(COperation item)
 {
     data.Add(item);
     return(true);
 }