コード例 #1
0
        private void saveprivate()
        {
            ado_data_access p_ado   = new ado_data_access();
            string          strMDB  = ((frmMain)this.ParentForm.ParentForm).frmProject.uc_project1.txtPersonal.Text.Trim() + "\\personal_project_links_and_notes.mdb";
            string          strConn = p_ado.getMDBConnString(strMDB, "admin", "");
            //string strConn = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + strMDB + ";User Id=admin;Password=;";
            string strSQL = "";

            p_ado.OpenConnection(strConn);
            if (p_ado.m_intError == 0)
            {
                try
                {
                    string strNotes = this.txtNotesPersonal.Text;
                    strNotes = p_ado.FixString(strNotes, "'", "''");
                    if ((int)p_ado.getRecordCount(p_ado.m_OleDbConnection, "SELECT COUNT(*) FROM NOTES", "NOTES") > 0)
                    {
                        strSQL = "UPDATE NOTES SET NOTES = '" + strNotes + "'";
                        p_ado.SqlNonQuery(p_ado.m_OleDbConnection, strSQL);
                    }
                    else
                    {
                        strSQL = "INSERT INTO NOTES (NOTES) VALUES ('" + strNotes + "')";
                        p_ado.SqlNonQuery(p_ado.m_OleDbConnection, strSQL);
                    }
                }
                catch
                {
                }
            }
            p_ado = null;
        }
コード例 #2
0
        private void mnuEditBrowse_Click(object sender, System.EventArgs e)
        {
            //instantiate the datasource class
            //FIA_Biosum_Manager.Datasource p_datasource = new Datasource(((frmDialog)this.ParentForm).m_frmMain.frmProject.uc_project1.txtRootDirectory.Text.Trim());
            FIA_Biosum_Manager.Datasource p_datasource = new Datasource();
            p_datasource.LoadTableColumnNamesAndDataTypes = false;
            p_datasource.LoadTableRecordCount             = false;
            p_datasource.m_strDataSourceMDBFile           = frmMain.g_oFrmMain.frmProject.uc_project1.txtRootDirectory.Text.Trim() + "\\db\\project.mdb";
            p_datasource.m_strDataSourceTableName         = "datasource";
            p_datasource.m_strScenarioId = "";
            p_datasource.populate_datasource_array();


            int intPlot = p_datasource.getTableNameRow("PLOT");

            //see if datasource found the PLOT table type
            if (intPlot >= 0)
            {
                string strFile = p_datasource.m_strDataSource[intPlot, PATH].Trim() + "\\" +
                                 p_datasource.m_strDataSource[intPlot, MDBFILE].Trim();

                ado_data_access oAdo    = new ado_data_access();
                string          strConn = oAdo.getMDBConnString(strFile, "", "");
                oAdo.OpenConnection(strConn);
                if (oAdo.m_intError == 0)
                {
                    //see if the MDB file is found and the plot table is found
                    if (p_datasource.m_strDataSource[intPlot, FILESTATUS].Trim() == "F" &&
                        p_datasource.m_strDataSource[intPlot, TABLESTATUS].Trim() == "F")
                    {
                        //see if there are records in the plot table
                        if (Convert.ToInt32(oAdo.getRecordCount(oAdo.m_OleDbConnection, "SELECT COUNT(*) FROM " + p_datasource.m_strDataSource[intPlot, TABLE].Trim(), "temp")) > 0)
                        {
                            //string strConn="";


                            oAdo.CloseConnection(oAdo.m_OleDbConnection);

                            FIA_Biosum_Manager.frmGridView frmGV = new frmGridView();
                            frmGV.strProjectDirectory = frmMain.g_oFrmMain.frmProject.uc_project1.txtRootDirectory.Text.Trim();

                            //frmGV.MdiParent = (frmMain)this.ParentForm.ParentForm;
                            frmGV.Text = "Database: Browse And Delete Plot Records";
                            frmGV.LoadDataSetToDeleteOnly(strConn, "select * from " + p_datasource.m_strDataSource[intPlot, TABLE].Trim() + ";", p_datasource.m_strDataSource[intPlot, TABLE].Trim());
                            frmMain.g_oFrmMain.Enabled = false;
                            frmGV.MinimizeMainForm     = true;
                            frmGV.Show();
                            //frmGV.Show();
                            //frmGV.Focus();
                        }
                        else
                        {
                            oAdo.CloseConnection(oAdo.m_OleDbConnection);
                            MessageBox.Show("!!No Records In The PLOT table!!", "BROWSE AND DELETE PLOT RECORDS", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Exclamation);
                        }
                    }
                    else
                    {
                        oAdo.CloseConnection(oAdo.m_OleDbConnection);
                        MessageBox.Show("!!Could not find either the MDB File named \n" +
                                        p_datasource.m_strDataSource[intPlot, MDBFILE] + "\n" +
                                        " or the plot table named \n" +
                                        p_datasource.m_strDataSource[intPlot, TABLE].Trim() + "!!",
                                        "BROWSE AND DELETE PLOT RECORDS",
                                        System.Windows.Forms.MessageBoxButtons.OK,
                                        System.Windows.Forms.MessageBoxIcon.Exclamation);
                    }
                }
            }
            else
            {
                MessageBox.Show("!!Could not find the table type PLOT in the datasource table!!", "BROWSE AND DELETE PLOT RECORDS", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Exclamation);
            }
        }
コード例 #3
0
        //Get the Select files and check to see how many records are in the selected Verified files, TODO: otherwise?
        //Check for null when calling
        private Hashtable DbRecsCountVerify(ArrayList aryOfExistingFvsRxMdbFiles)
        {
            Hashtable htTmp  = null;
            string    strSql = "SELECT COUNT(*) FROM FVS_TREELIST";

            if (aryOfExistingFvsRxMdbFiles.Count < 1)
            {
                return(htTmp);
            }
            else
            {
                htTmp = new Hashtable();
                ado_data_access adoD = new ado_data_access();
                for (short x = 0; x < aryOfExistingFvsRxMdbFiles.Count; x++)
                {
                    htTmp.Add(aryOfExistingFvsRxMdbFiles[x].ToString(), Convert.ToInt32(adoD.getRecordCount(string.Format(this.strDbConx, string.Format(this.strPathFvsDbFile, aryOfExistingFvsRxMdbFiles[x].ToString())), strSql, "FVS_TREELIST")));
                }
            }
            return(htTmp);
        }