Пример #1
0
        private void btnTest_Click(object sender, RoutedEventArgs e)
        {
            //string sql = "insert into Table2 (Name) Values ('你我他')";
            //db.update(sql);

            string    sql = "select * from table2";
            DataTable tbl = db.query(sql);

            if (CSTR.IsTableEmpty(tbl))
            {
                return;
            }

            foreach (DataRow row in tbl.Rows)
            {
                MessageBox.Show(CSTR.ObjectTrim(row["Name"]));
            }
        }
Пример #2
0
        private void Execute()
        {
            // Always validate using this call first
            string strError = String.Empty;

            if (!bValidateDialog(ref strError, false))
            {
                ShowErrorAndExit(strError);
            }

            // --- is the database loaded? ---

            var szName = "";

            m_sDBName.GetFilePath(ref szName);
            CSTR.IFileExt(szName, ".gdb", ref szName, GeoEngine.Core.GXNet.Constant.FILE_EXT_FORCE);
            if (CEDB.iLoaded(szName) == 1)
            {
                CEDB.UnLoad(szName);
            }

            // --- Get Parameters ---

            int iLines    = m_iLines.iGetValue();
            int iChannels = m_iChannels.iGetValue();
            int iCompress = Convert.ToInt32(m_cbCompression.strGetValue());
            int iPageSize = Convert.ToInt32(m_cbMaxData.strGetValue());

            int    iBlobs     = ini.GetInt("BLOBS");
            int    iUsers     = ini.GetInt("USERS");
            int    iErase     = ini.GetInt("ERASE");
            string szSuper    = ini.GetString("SUPER");
            string szPassword = ini.GetString("PASSWORD");
            string szCurDB    = ini.GetString("CURDB");

            int iMinBlobs = iLines + iChannels + 100;

            if (iBlobs < iMinBlobs)
            {
                iBlobs = iMinBlobs;
            }

            if (iUsers <= 0 || iUsers == GeoEngine.Core.GXNet.Constant.iDUMMY)
            {
                iUsers = 10;
            }

            if (iErase <= 0 || iErase == GeoEngine.Core.GXNet.Constant.iDUMMY)
            {
                iErase = Convert.ToInt32(iLines * iChannels * 0.05);
                if (iErase < 100)
                {
                    iErase = 100;
                }
                if (iErase > 10000)
                {
                    iErase = 10000;
                }
            }

            if (szSuper.Length == 0)
            {
                szSuper = "SUPER";
            }

            if (szPassword.Length == 0)
            {
                szPassword = "";
            }

            if (szCurDB.Length > 0 && szCurDB.CompareTo(szName) == 0)
            {
                ShowErrorAndExit(_("Specified database is protected against overwrite."));
            }

            if (CSYS.iScript() == 0)
            {
                CPROJ.iRemoveDocument(szName);
            }

            CDB.CreateComp(szName, iLines, iChannels, iBlobs, iUsers, iErase, szSuper, szPassword, iPageSize, iCompress);

            if (CSYS.iScript() != 1)
            {
                CEDB.LoadNew(szName);
            }
        }