コード例 #1
0
        private void btInfo_Click(object sender, EventArgs e)
        {
            DAO.DBEngine dbe = new DAO.DBEngine();

            DAO.Database myDB = dbe.OpenDatabase(path);
            lstInfo.Items.Add("the database: " + myDB.Name);

            //loop to display the tables
            for (int t = 0; t < myDB.TableDefs.Count; t++)
            {
                if (myDB.TableDefs[t].Attributes == 0)
                {
                    lstInfo.Items.Add("- table :" + myDB.TableDefs[t].Name);

                    //loop to display the fields of each table
                    for (int f = 0; f < myDB.TableDefs[t].Fields.Count; f++)
                    {
                        lstInfo.Items.Add("\t - Fields: " + myDB.TableDefs[t].Fields[f].Name);
                    }
                    //loop to display inedexes
                    for (int g = 0; g < myDB.TableDefs[t].Indexes.Count; g++)
                    {
                        lstInfo.Items.Add("\t - Fields: " + myDB.TableDefs[t].Indexes[g].Name);


                        for (int f = 0; f < ((DAO.IndexFields)(myDB.TableDefs[t].Indexes[g].Fields)).Count; f++)
                        {
                            lstInfo.Items.Add("\t\t Index Fields : " + ((Field)(((IndexFields)(myDB.TableDefs[t].Indexes[g].Fields))[f])).Name);
                        }
                    }
                }
            }

            //loop to display the relation
            for (int r = 0; r < myDB.Relations.Count; r++)
            {
                if (myDB.Relations[r].Attributes == 0)
                {
                    lstInfo.Items.Add("- Relation: " + myDB.Relations[r].Name);

                    lstInfo.Items.Add("\t Primary Table: " + myDB.Relations[r].Table);

                    lstInfo.Items.Add("\t Foreign Table: " + myDB.Relations[r].ForeignTable);


                    //loop to display fields of relation
                    for (int f = 0; f < myDB.Relations[r].Fields.Count; f++)
                    {
                        lstInfo.Items.Add("\t\t Primary Field: " + myDB.Relations[r].Fields[f].Name);


                        lstInfo.Items.Add("\t\t Foreign field: " + myDB.Relations[r].Fields[f].ForeignName);
                    }
                }
            }

            myDB.Close();
        }
コード例 #2
0
ファイル: Access.cs プロジェクト: rebider/soa
        protected override void OnDispose(bool disposing)
        {
            base.OnDispose(disposing);

            try
            {
                if (_Columns != null && _Columns.Count > 0)
                {
                    foreach (ADOColumn item in _Columns)
                    {
                        item.Dispose();
                    }
                }
                if (_Table != null)
                {
                    Marshal.ReleaseComObject(_Table);
                }
                if (_Cat != null)
                {
                    Marshal.ReleaseComObject(_Cat);
                }
                if (_Conn != null)
                {
                    _Conn.Close();
                    Marshal.ReleaseComObject(_Conn);
                }

                if (_TableDef != null)
                {
                    Marshal.ReleaseComObject(_TableDef);
                }
                if (_Db != null)
                {
                    _Db.Close();
                    Marshal.ReleaseComObject(_Db);
                }
                if (_Dbe != null)
                {
                    Marshal.ReleaseComObject(_Dbe);
                }
            }
            catch (Exception ex)
            {
                if (DAL.Debug)
                {
                    DAL.WriteLog(ex.ToString());
                }
            }
        }
コード例 #3
0
ファイル: Access.cs プロジェクト: zshankang/X
        public void Dispose()
        {
            try
            {
                if (_Columns != null && _Columns.Count > 0)
                {
                    foreach (var item in _Columns)
                    {
                        item.Dispose();
                    }
                }
                if (_Table != null)
                {
                    Marshal.ReleaseComObject(_Table);
                }
                if (_Cat != null)
                {
                    Marshal.ReleaseComObject(_Cat);
                }
                if (_Conn != null)
                {
                    _Conn.Close();
                    Marshal.ReleaseComObject(_Conn);
                }

                if (_TableDef != null)
                {
                    Marshal.ReleaseComObject(_TableDef);
                }
                if (_Db != null)
                {
                    _Db.Close();
                    Marshal.ReleaseComObject(_Db);
                }
                if (_Dbe != null)
                {
                    Marshal.ReleaseComObject(_Dbe);
                }
            }
            catch (Exception ex)
            {
                if (DAL.Debug)
                {
                    DAL.WriteLog(ex.ToString());
                }
            }
        }