예제 #1
0
        public void Open()
        {
            clsRegKey oReg = new clsRegKey();

            oReg.RegistryPathCurrentUser = clsGlobal.s_FullRegKey;
            if (clsGlobal.firstConnect || string.IsNullOrEmpty(clsGlobal.str_Server))
            {
                clsGlobal.firstConnect = false;
            }
            m_Server   = clsGlobal.str_Server;
            m_Database = clsGlobal.str_Database;
            m_Port     = Convert.ToInt32(clsGlobal.str_Port) + "";
            m_User     = clsGlobal.str_User;
            m_Password = clsGlobal.str_Password;

            string SConnString = "Server=" + clsGlobal.str_Server +
                                 ";Database=" + clsGlobal.str_Database +
                                 ";Port=" + Convert.ToInt32(clsGlobal.str_Port) +
                                 ";User ID=" + clsGlobal.str_User +
                                 ";Password="******";Pooling =false;";

            if (Conn.State == ConnectionState.Open)
            {
                Conn.Close();
            }
            Conn.ConnectionString = SConnString;
            Conn.Open();
        }
예제 #2
0
        public void OpenTesting()
        {
            clsRegKey oReg = new clsRegKey();

            oReg.RegistryPathCurrentUser = clsGlobal.s_FullRegKey;

            string SConnString = "Server = " + Server +
                                 ";Database=" + Database +
                                 ";Port=" + Convert.ToInt32(Port) +
                                 ";Userid=" + User +
                                 ";Password=" + Password;


            if (Conn.State == ConnectionState.Open)
            {
                Conn.Close();
            }
            Conn.ConnectionString = SConnString;
            Conn.Open();
        }
예제 #3
0
 public static void xsetupdatedatabase(string strSql)
 {
     try
     {
         clsRegKey oReg = new clsRegKey();
         oReg.RegistryPathCurrentUser = clsGlobal.s_FullRegKey;
         using (clsConnection oConn = new clsConnection())
         {
             oConn.Open();
             NpgsqlCommand ocmd = new NpgsqlCommand();
             ocmd             = new NpgsqlCommand();
             ocmd.Connection  = oConn.Conn;
             ocmd.CommandText = strSql;
             ocmd.ExecuteNonQuery();
             oConn.Close();
         }
     }
     catch (Exception ex)
     {
         //throw
     }
 }