Example #1
0
        private void Connect()
        {
            e = 0;
            Disconnect();

            if (type == 0)
            {
                db = new cDB_MySQL();
            }
            else if (type == 1)
            {
                db = new cDB_Oracle();
            }

#if false
            if (type == 0)
            {
                conStr += "DRIVER={MySQL ODBC 3.51 Driver};" +
                          "SERVER=127.0.0.1;" +
                          "DATABASE=test;" +
                          "UID=php;" +
                          "PASSWORD=12345;" +
                          "OPTION=3";
            }
            else if (type == 1)
            {
                conStr += "DRIVER={Oracle ODBC Driver};" +
                          "SERVER=prover.cs.csubak.edu;" +
                          //"DATABASE=database;" +
                          "UID=cs342;" +
                          "PWD=student2";
            }
#endif

            try
            {
                db.Connect();
            } catch (SystemException exp) {
                string err = exp.Message;
                cIAGS.ErrorMsg = string.Format("Could not connect to \"{0}\" Database Server.", cDB.Type);
                MessageBox.Show(cIAGS.ErrorMsg, "DBMS Connection Error");

                e = 2;
            }
        }
Example #2
0
        private void Connect()
        {
            e = 0;
            Disconnect();

            if (type == 0)
            {
                db = new cDB_MySQL();
            }
            else if (type == 1)
            {
                db = new cDB_Oracle();
            }

            #if false
            if(type == 0) {
                conStr += "DRIVER={MySQL ODBC 3.51 Driver};" +
                        "SERVER=127.0.0.1;" +
                        "DATABASE=test;" +
                        "UID=php;" +
                        "PASSWORD=12345;" +
                        "OPTION=3";
            }
            else if (type == 1) {
                conStr += "DRIVER={Oracle ODBC Driver};" +
                    "SERVER=prover.cs.csubak.edu;" +
                    //"DATABASE=database;" +
                    "UID=cs342;" +
                    "PWD=student2";
            }
            #endif

            try
            {
               db.Connect();

            } catch(SystemException exp) {
                string err = exp.Message;
                cIAGS.ErrorMsg = string.Format("Could not connect to \"{0}\" Database Server.", cDB.Type);
                MessageBox.Show(cIAGS.ErrorMsg, "DBMS Connection Error");

                e = 2;
            }
        }