예제 #1
0
        public static void Replace(this Recordset recordset, SboUserDefinedTableDefinition record)
        {
            var tableName = record.GetType().GetCustomAttributes(typeof(SboUserDefinedTableAttribute), true).Select(a => ((SboUserDefinedTableAttribute)a).Name).FirstOrDefault();

            if (recordset.DoQueryValue <int>(@"SELECT COUNT(*) FROM ""@{0}"" WHERE ""Code"" = '{1}'", tableName, record.Code) > 0)
            {
                Update(recordset, record);
            }
            else
            {
                Insert(recordset, record);
            }
        }