Example #1
0
        private void frmTables_Load(object sender, EventArgs e)
        {
            // Populate the Language Pulldown
            ProgSettings.LoadLangs(lstLangs);

            // The following command reads all the columns for the selected table
            var dbViewList =
                ProgSettings.SelectRows(
                    "SELECT T.TABLE_NAME AS TableName, T.ENGINE AS TableEngine, T.TABLE_COMMENT AS TableComment FROM INFORMATION_SCHEMA.Tables T WHERE T.TABLE_NAME <> 'dtproperties' AND T.TABLE_SCHEMA <> 'INFORMATION_SCHEMA' AND T.TABLE_SCHEMA='" +
                    ProgSettings.DbName + "' ORDER BY T.TABLE_NAME");

            // Did we return anything
            if (dbViewList != null)
            {
                // Do we have rows
                if (dbViewList.Tables[0].Rows.Count > 0)
                {
                    lstTables.Items.Clear();

                    // for each Field returned, populate the listbox with the table name
                    for (var thisRow = 0; thisRow <= dbViewList.Tables[0].Rows.Count - 1; thisRow++)
                    {
                        var tableName = dbViewList.Tables[0].Rows[thisRow]["TableName"].ToString();
                        lstTables.Items.Add(tableName);
                    }
                }
            }

            blnTextChanged = false;
        }
Example #2
0
        private void frmFields_Load(object sender, EventArgs e)
        {
            Text = Resources.DBDocs_for_Table + TableName;
            ProgSettings.LoadLangs(lstLangs);

            // The following command reads all the columns for the selected table
            var dbViewList = ProgSettings.SelectRows("SHOW COLUMNS FROM " + TableName);

            // Did we return anything
            if (dbViewList != null)
            {
                // Do we have rows
                if (dbViewList.Tables[0].Rows.Count > 0)
                {
                    lstFields.Items.Clear();

                    // for each Field returned, populate the listbox with the column name
                    for (var thisRow = 0; thisRow <= dbViewList.Tables[0].Rows.Count - 1; thisRow++)
                    {
                        var fieldName = dbViewList.Tables[0].Rows[thisRow]["Field"].ToString();
                        lstFields.Items.Add(fieldName);
                    }
                }
            }

            blnTextChanged = false;
        }
Example #3
0
        private void frmsubtables_Load(object sender, EventArgs e)
        {
            // Populate the Language Pulldown
            ProgSettings.LoadLangs(lstLangs);

            DataSet dbViewList;

            if (SubTableId == 0)
            {
                // The following command reads all the columns for all the subtables
                dbViewList = ProgSettings.SelectRows("SELECT subtablename from dbdocssubtables");
            }
            else
            {
                // The following command reads all the columns for just the selected subtable
                dbViewList =
                    ProgSettings.SelectRows("SELECT subtablename from dbdocssubtables where subtableid=" + SubTableId);
            }

            // Did we return anything
            if (dbViewList == null)
            {
                return;
            }

            // Do we have rows
            if (dbViewList.Tables[0].Rows.Count <= 0)
            {
                return;
            }

            // for each Field returned, populate the listbox with the table name
            for (var thisRow = 0; thisRow <= dbViewList.Tables[0].Rows.Count - 1; thisRow++)
            {
                var fieldName = dbViewList.Tables[0].Rows[thisRow]["subtablename"].ToString();
                lstsubtables.Items.Add(fieldName);
            }

            if (SubTableId != 0)
            {
                //Select the first entry if we passed in an Id
                if (lstsubtables.SelectedIndex < 0)
                {
                    lstsubtables.SelectedIndex = 0;
                }
                Text = Resources.SubTable + lstsubtables.Text;
            }
            else
            {
                Text = Resources.SubTables;
            }

            blnTextChanged = false;
        }