Example #1
0
        static void Main(string[] args)
        {
            // Test the column routines

            DataHandler dh = new DataHandler("", "test");

            dh.Open(true);
            DataColumn c = new DataColumn();

            c.ColumnName = "first";
            c.DataType   = System.Type.GetType("System.String");
            c.MaxLength  = 10;
            dh.Add(c);
            c            = new DataColumn();
            c.ColumnName = "second";
            c.DataType   = System.Type.GetType("System.String");
            dh.Add(c);
            c            = new DataColumn();
            c.ColumnName = "third";
            c.DataType   = System.Type.GetType("System.Int16");
            dh.Add(c);

            // Update - shorter string

            c            = new DataColumn();
            c.ColumnName = "2";
            c.DataType   = System.Type.GetType("System.String");
            dh.Set(c, 1);

            // Update - longer string

            c            = new DataColumn();
            c.ColumnName = "deuxième";
            c.DataType   = System.Type.GetType("System.String");
            dh.Set(c, 1);

            c = dh.Get(0);
            Console.WriteLine(c.ColumnName);

            // Remove - column

            c            = new DataColumn();
            c.ColumnName = "second";
            dh.Remove(c);
        }
Example #2
0
        public bool Remove(DataColumn column)
        {
            bool removed = false;
            bool match   = false;

            for (int item = 0; item < _handler.Items; item++)
            {
                if (_handler.Get(item).ColumnName == column.ColumnName)
                {
                    match = true;
                }
            }

            if (match == true)
            {
                _handler.Remove(column);
                removed = true;
            }
            else
            {
                throw new ArgumentException();
            }
            return(removed);
        }