예제 #1
0
        public void AddColumn(string ColumnName, SQLBuilderTypes SQLType, bool AllowNull, int MaxLen, object DefaultValue)
        {
            SQLColumnDefinition d = new SQLColumnDefinition();

            d.SQLType   = SQLType;
            d.AllowNull = AllowNull;
            d.MaxLen    = MaxLen;
            d.Value     = null;

            if (DefaultValue == null)
            {
                switch (SQLType)
                {
                case SQLBuilderTypes.sqlString:
                case SQLBuilderTypes.sqlMemo:
                case SQLBuilderTypes.sqlChar:
                    d.DefaultValue = "";
                    break;

                case SQLBuilderTypes.sqlBool:
                    d.DefaultValue = false;
                    break;

                case SQLBuilderTypes.sqlInt:
                    d.DefaultValue = 0;
                    break;

                case SQLBuilderTypes.sqlFloat:
                    d.DefaultValue = 0;
                    break;

                case SQLBuilderTypes.sqlDate:
                    d.DefaultValue = new DateTime(1990, 1, 1);
                    break;
                }
            }
            else
            {
                d.DefaultValue = DefaultValue;
            }


            if (!Columns.ContainsKey(ColumnName))
            {
                Columns.Add(ColumnName, d);
                ColumnNames.Add(ColumnName);
            }
        }
예제 #2
0
        public bool AddValue(string ColumnName, object Data)
        {
            if (!Columns.ContainsKey(ColumnName))
            {
                System.Diagnostics.Debug.Assert(false, "ColumnName not found.");
                return(false);
            }

            SQLColumnDefinition d = Columns[ColumnName];

            if (d == null)
            {
                return(false);
            }

            d.Value = Data;
            return(true);
        }