Exemple #1
0
        private models.aTable returnTableData(string name)
        {
            models.aTable retour = null;
            DataTable     result;

            models.aField     f;
            models.aFieldType ft;
            try
            {
                result = _conn.GetSchema("Columns", new string[] { null, name, null });
                if (result != null)
                {
                    retour = new models.aTable();
                    foreach (DataRow ligne in result.Rows)
                    {
                        f           = new IMDEV.Database.models.aField();
                        f.name      = ligne["COLUMN_NAME"].ToString();
                        ft          = new IMDEV.Database.models.aFieldType();
                        ft.name     = ligne["DATATYPE"].ToString();
                        f.fieldType = ft;
                        retour.listOfFields.Add(f);
                    }
                }
            }
            catch (Exception ex)
            {
                _lastError = ex.Message;
            }
            return(retour);
        }
Exemple #2
0
        protected IMDEV.Database.models.aTable returnTableData(string name, string db, string schema)
        {
            models.aTable          retour = null;
            Common.unRetourRequete result;
            models.aField          f;
            models.aFieldType      ft;

            result = retourneDonnees("select * from information_schema.columns where table_name='" + name.Trim() + "' and table_catalog='" + db + "' and table_schema='" + schema + "'");
            if (result != null)
            {
                retour           = new IMDEV.Database.models.aTable();
                retour.tableName = name.Trim();
                foreach (DataRow ligne in result.Tables[0].Rows)
                {
                    f           = new IMDEV.Database.models.aField();
                    ft          = new IMDEV.Database.models.aFieldType();
                    ft.name     = ligne["data_type"].ToString();
                    f.fieldType = ft;
                    f.name      = ligne["column_name"].ToString();
                    retour.listOfFields.Add(f);
                }
            }
            return(retour);
        }