当前位置: 首页>>代码示例>>C#>>正文


C# FdoConnection.Close方法代码示例

本文整理汇总了C#中FdoToolbox.Core.Feature.FdoConnection.Close方法的典型用法代码示例。如果您正苦于以下问题:C# FdoConnection.Close方法的具体用法?C# FdoConnection.Close怎么用?C# FdoConnection.Close使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在FdoToolbox.Core.Feature.FdoConnection的用法示例。


在下文中一共展示了FdoConnection.Close方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Execute

        public override int Execute()
        {
            CommandStatus retCode;
            FdoConnection conn = null;
            try
            {
                conn = new FdoConnection(_provider, _connStr);
                conn.Open();
            }
            catch (OSGeo.FDO.Common.Exception ex)
            {
                WriteException(ex);
                retCode = CommandStatus.E_FAIL_CONNECT;
                return (int)retCode;
            }

            using (conn)
            {
                using (FdoFeatureService service = conn.CreateFeatureService())
                {
                    try
                    {
                        service.CreateDataStore(_dstoreStr);
                        WriteLine("Data Store Created!");
                        retCode = CommandStatus.E_OK;
                    }
                    catch (OSGeo.FDO.Common.Exception ex)
                    {
                        WriteException(ex);
                        retCode = CommandStatus.E_FAIL_CREATE_DATASTORE;
                        return (int)retCode;
                    }
                }
                if (conn.State != FdoConnectionState.Closed)
                    conn.Close();
            }
            return (int)retCode;
        }
开发者ID:stophun,项目名称:fdotoolbox,代码行数:38,代码来源:CreateDataStoreCommand.cs

示例2: TestConnection

 public void TestConnection()
 {
     FdoConnection conn = new FdoConnection("OSGeo.ODBC", string.Format("ConnectionString=\"{0}\"", _view.BuilderObject.ToConnectionString()));
     try
     {
         FdoConnectionState state = conn.Open();
         if (state == FdoConnectionState.Open)
         {
             _view.ShowMessage(null, "Test successful");
             conn.Close();
         }
         else
         {
             _view.ShowError("Connection test failed");
         }
     }
     catch (FdoException ex)
     {
         _view.ShowError(ex.InnerException.Message);
     }
 }
开发者ID:jumpinjackie,项目名称:fdotoolbox,代码行数:21,代码来源:ConnectOdbcPresentation.cs

示例3: Test

 internal bool Test()
 {
     using (var conn = new FdoConnection(_view.Provider, GetBaseConnectionString()))
     {
         if (conn.Open() != FdoConnectionState.Closed)
         {
             conn.Close();
             return true;
         }
     }
     return false;
 }
开发者ID:jumpinjackie,项目名称:fdotoolbox,代码行数:12,代码来源:CreateRdbmsCtlPresentation.cs

示例4: TestConnection

        public void TestConnection()
        {
            FdoProviderInfo provider = _view.SelectedProvider;
            string connStr = ExpressUtility.ConvertFromNameValueCollection(_view.ConnectProperties);

            FdoConnection conn = new FdoConnection(provider.Name, connStr);
            try
            {
                FdoConnectionState state = conn.Open();
                if (state == FdoConnectionState.Open || state == FdoConnectionState.Pending)
                {
                    _view.ShowMessage(null, "Test successful");
                    conn.Close();
                }
                else
                {
                    _view.ShowError("Connection test failed");
                }
            }
            catch (FdoException ex)
            {
                _view.ShowError(ex.InnerException.Message);
            }
            finally
            {
                conn.Dispose();
            }
        }
开发者ID:jumpinjackie,项目名称:fdotoolbox,代码行数:28,代码来源:FdoConnectCtlPresentation.cs

示例5: Create

        public bool Create()
        {
            bool ok = true;
            FdoConnection conn = new FdoConnection(_view.Provider, GetBaseConnectionString());
            bool created = false;
            bool cleanup = true;
            try
            {
                using (var svc = conn.CreateFeatureService())
                {
                    try
                    {
                        CreateDataStore(svc);
                        created = true;
                    }
                    catch (Exception ex)
                    {
                        _view.ShowError(ex);
                        created = false;
                        ok = false;
                    }
                }

                if (created)
                {
                    //Amend the connection string to include the data store
                    var builder = new DbConnectionStringBuilder();
                    builder.ConnectionString = conn.ConnectionString;
                    builder[_view.DataStoreParameter] = _view.DataStoreName;
                    conn.ConnectionString = builder.ConnectionString;
                    conn.Open();

                    using (var svc = conn.CreateFeatureService())
                    {
                        CreateDefaultSpatialContext(svc);
                    }
                }
            }
            finally
            {
                if (created)
                {
                    if (File.Exists(_view.SchemaFile))
                    {
                        ApplySchemas(conn);
                    }

                    if (_view.ConnectOnCreate)
                    {
                        _connMgr.AddConnection(_view.ConnectionName, conn);
                        cleanup = false;
                    }
                }

                if (cleanup)
                {
                    conn.Close();
                    conn.Dispose();
                }
            }

            return ok;
        }
开发者ID:jumpinjackie,项目名称:fdotoolbox,代码行数:63,代码来源:CreateRdbmsCtlPresentation.cs


注:本文中的FdoToolbox.Core.Feature.FdoConnection.Close方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。