Exemple #1
0
        bool CreateTables()
        {
            string createQuery;

            for (int i = 1; i <= tabinfo.Length; i++)
            {
                string [] constraints = ConfigClass.GetColumnDetails(node, i, "constraint");

                createQuery  = "create table " + tabinfo [i - 1].name;
                createQuery += "(";

                for (int col = 1; col <= tabinfo [i - 1].columns.Length; col++)
                {
                    createQuery += tabinfo [i - 1].columns [col - 1];
                    createQuery += " ";
                    createQuery += tabinfo [i - 1].types [col - 1];
                    createQuery += " " + constraints [col - 1];
                    createQuery += ",";
                }
                createQuery  = createQuery.Trim(',');
                createQuery += ")";
                Console.WriteLine(createQuery);
                cmd.CommandText = createQuery;
                cmd.ExecuteNonQuery();
            }
            return(true);
        }
Exemple #2
0
        public void Initialize(XmlNode doc, int tableNum)
        {
            string tableTag = "table" + tableNum;

            name    = ConfigClass.GetElement(doc, "tables", tableTag, "name");
            columns = ConfigClass.GetColumnDetails(doc, tableNum, "name");
            types   = ConfigClass.GetColumnDetails(doc, tableNum, "type");
        }