public void GetFields(Connection cnt)
        {
            System.Data.DataTable schemaColumn;
            fields  = new FieldList();
            Indexes = null;
            //
            //=====================================================
            dbWrapper db = new dbWrapper();

            db.CreateCommand((Connection)cnt.Clone());
            EPField fld;

            if (cnt.IsOleDb)
            {
                db.SetCommandText(TableName);
                db.SetCommandType(System.Data.CommandType.TableDirect);
            }
            else
            {
                db.SetCommandText("SELECT * FROM " + DatabaseEditUtil.SepBegin(cnt.NameDelimiterStyle) + TableName + DatabaseEditUtil.SepEnd(cnt.NameDelimiterStyle));
                db.SetCommandType(System.Data.CommandType.Text);
            }
            try
            {
                if (cnt.IsOleDb || cnt.IsMSSQL)
                {
                    db.OpenReader(System.Data.CommandBehavior.KeyInfo);
                }
                else
                {
                    db.OpenReader(System.Data.CommandBehavior.SchemaOnly);
                }
                schemaColumn = db.GetSchemaTable();
                db.CloseReader();
                db.Close();
                if (schemaColumn != null)
                {
                    for (int i = 0; i < schemaColumn.Rows.Count; i++)
                    {
                        fld = EPField.MakeFieldFromColumnInfo(i, schemaColumn.Rows[i]);
                        if (!string.IsNullOrEmpty(fld.Name))
                        {
                            fld.FromTableName = TableName;
                            fields.AddField(fld);
                        }
                    }
                }
            }
            catch (Exception er)
            {
                FormLog.NotifyException(true, er);
            }
            finally
            {
                db.CloseReader();
                db.Close();
            }
        }
 public void LoadViews()
 {
     Views = null;
     try
     {
         if (dbCon.TheConnection is OleDbConnection)
         {
         }
         else if (dbCon.TheConnection is SqlConnection)
         {
             dbWrapper db = new dbWrapper();
             db.CreateCommand(dbCon);
             db.SetCommandText("SELECT [name] FROM sysobjects (nolock) WHERE [type] = 'V'");
             db.SetCommandType(System.Data.CommandType.Text);
             db.CreateAdapter();
             System.Data.DataSet ds = new System.Data.DataSet("DS");
             db.Fill(ds, "Views");
             if (ds.Tables.Count > 0)
             {
                 if (ds.Tables[0].Rows.Count > 0)
                 {
                     Views = new DatabaseView[ds.Tables[0].Rows.Count];
                     for (int i = 0; i < Views.Length; i++)
                     {
                         Views[i]          = new DatabaseView();
                         Views[i].ViewName = ds.Tables[0].Rows[i][0].ToString();
                     }
                 }
             }
         }
         else
         {
             DataTable vs = dbCon.GetViews();
             if (vs != null && vs.Rows.Count > 0)
             {
                 Views = new DatabaseView[vs.Rows.Count];
                 for (int i = 0; i < Views.Length; i++)
                 {
                     Views[i]          = new DatabaseView();
                     Views[i].ViewName = vs.Rows[i][0].ToString();
                 }
             }
         }
     }
     catch
     {
     }
 }
        public void GetFields(Connection cnt)
        {
            int i;

            System.Data.DataTable schemaColumn = null;
            fields = new FieldList();
            if (cnt.IsOdbc)
            {
                return;
            }
            //=====================================================
            EPField   fld;
            dbWrapper db = new dbWrapper();

            db.CreateCommand(cnt);
            string sep1 = DatabaseEditUtil.SepBegin(cnt.NameDelimiterStyle);
            string sep2 = DatabaseEditUtil.SepEnd(cnt.NameDelimiterStyle);

            db.SetCommandText("SELECT * FROM " + sep1 + ViewName + sep2);
            db.SetCommandType(System.Data.CommandType.Text);
            try
            {
                db.OpenReader(System.Data.CommandBehavior.SchemaOnly);
                schemaColumn = db.GetSchemaTable();
                db.CloseReader();
                db.Close();
                if (schemaColumn != null)
                {
                    for (i = 0; i < schemaColumn.Rows.Count; i++)
                    {
                        fld = EPField.MakeFieldFromColumnInfo(i, schemaColumn.Rows[i]);
                        fld.FromTableName = ViewName;
                        fields.AddField(fld);
                    }
                }
            }
            catch
            {
            }
            finally
            {
                db.CloseReader();
                db.Close();
            }
        }