Code:
/ Net / Net / 3.5.50727.3053 / DEVDIV / depot / DevDiv / releases / whidbey / netfxsp / ndp / fx / src / Data / System / Data / Odbc / OdbcEnvironmentHandle.cs / 1 / OdbcEnvironmentHandle.cs
//------------------------------------------------------------------------------ //// Copyright (c) Microsoft Corporation. All rights reserved. // //[....] //[....] //----------------------------------------------------------------------------- using System; using System.Collections; using System.ComponentModel; using System.Data; using System.Data.Common; using System.Diagnostics; using System.Globalization; using System.Runtime.InteropServices; using System.Security; using System.Security.Permissions; using System.Text; using System.Threading; namespace System.Data.Odbc { sealed internal class OdbcEnvironmentHandle : OdbcHandle { internal OdbcEnvironmentHandle() : base(ODBC32.SQL_HANDLE.ENV, null) { ODBC32.RetCode retcode; //Set the expected driver manager version // retcode = UnsafeNativeMethods.SQLSetEnvAttr( this, ODBC32.SQL_ATTR.ODBC_VERSION, ODBC32.SQL_OV_ODBC3, ODBC32.SQL_IS.INTEGER); // ignore retcode //Turn on connection pooling //Note: the env handle controls pooling. Only those connections created under that //handle are pooled. So we have to keep it alive and not create a new environment //for every connection. // retcode = UnsafeNativeMethods.SQLSetEnvAttr( this, ODBC32.SQL_ATTR.CONNECTION_POOLING, ODBC32.SQL_CP_ONE_PER_HENV, ODBC32.SQL_IS.INTEGER); switch(retcode) { case ODBC32.RetCode.SUCCESS: case ODBC32.RetCode.SUCCESS_WITH_INFO: break; default: Dispose(); throw ODBC.CantEnableConnectionpooling(retcode); } } } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007. //------------------------------------------------------------------------------ //// Copyright (c) Microsoft Corporation. All rights reserved. // //[....] //[....] //----------------------------------------------------------------------------- using System; using System.Collections; using System.ComponentModel; using System.Data; using System.Data.Common; using System.Diagnostics; using System.Globalization; using System.Runtime.InteropServices; using System.Security; using System.Security.Permissions; using System.Text; using System.Threading; namespace System.Data.Odbc { sealed internal class OdbcEnvironmentHandle : OdbcHandle { internal OdbcEnvironmentHandle() : base(ODBC32.SQL_HANDLE.ENV, null) { ODBC32.RetCode retcode; //Set the expected driver manager version // retcode = UnsafeNativeMethods.SQLSetEnvAttr( this, ODBC32.SQL_ATTR.ODBC_VERSION, ODBC32.SQL_OV_ODBC3, ODBC32.SQL_IS.INTEGER); // ignore retcode //Turn on connection pooling //Note: the env handle controls pooling. Only those connections created under that //handle are pooled. So we have to keep it alive and not create a new environment //for every connection. // retcode = UnsafeNativeMethods.SQLSetEnvAttr( this, ODBC32.SQL_ATTR.CONNECTION_POOLING, ODBC32.SQL_CP_ONE_PER_HENV, ODBC32.SQL_IS.INTEGER); switch(retcode) { case ODBC32.RetCode.SUCCESS: case ODBC32.RetCode.SUCCESS_WITH_INFO: break; default: Dispose(); throw ODBC.CantEnableConnectionpooling(retcode); } } } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007.
Link Menu
This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- TraceSection.cs
- TextEndOfParagraph.cs
- FormViewInsertEventArgs.cs
- UInt32Converter.cs
- SqlNodeTypeOperators.cs
- ReaderWriterLock.cs
- AnnouncementClient.cs
- ContentHostHelper.cs
- SqlUdtInfo.cs
- IPipelineRuntime.cs
- ObjectView.cs
- CompiledQuery.cs
- XamlTreeBuilderBamlRecordWriter.cs
- Matrix3D.cs
- TCPListener.cs
- TileModeValidation.cs
- PlatformNotSupportedException.cs
- AssemblyResolver.cs
- ByValueEqualityComparer.cs
- CompressionTracing.cs
- DecimalAnimationUsingKeyFrames.cs
- Pkcs7Recipient.cs
- TimersDescriptionAttribute.cs
- ManagedFilter.cs
- CodeNamespace.cs
- CompositionDesigner.cs
- ClockGroup.cs
- WebBrowserEvent.cs
- GridEntryCollection.cs
- InputMethodStateChangeEventArgs.cs
- Wizard.cs
- ReadWriteSpinLock.cs
- TaskSchedulerException.cs
- HuffModule.cs
- BindableTemplateBuilder.cs
- ListMarkerSourceInfo.cs
- DataListDesigner.cs
- FieldReference.cs
- MetricEntry.cs
- BinaryFormatterWriter.cs
- LazyTextWriterCreator.cs
- DiscoveryEndpointElement.cs
- HtmlControl.cs
- XmlValidatingReaderImpl.cs
- PseudoWebRequest.cs
- PagesSection.cs
- UInt16Storage.cs
- WebPartConnectionsDisconnectVerb.cs
- InkCanvasInnerCanvas.cs
- SchemaComplexType.cs
- coordinatorscratchpad.cs
- Renderer.cs
- DataControlLinkButton.cs
- AsymmetricAlgorithm.cs
- RuleSettingsCollection.cs
- SafeNativeMethods.cs
- externdll.cs
- StringArrayEditor.cs
- TriggerActionCollection.cs
- SafeFileMappingHandle.cs
- RecommendedAsConfigurableAttribute.cs
- SoapFormatExtensions.cs
- Gdiplus.cs
- MonitoringDescriptionAttribute.cs
- updateconfighost.cs
- ContentPosition.cs
- CryptoConfig.cs
- log.cs
- ButtonAutomationPeer.cs
- CollectionViewSource.cs
- Descriptor.cs
- SiteIdentityPermission.cs
- CompilerTypeWithParams.cs
- Receive.cs
- SqlDataSourceWizardForm.cs
- XmlUtil.cs
- SqlWebEventProvider.cs
- PasswordRecovery.cs
- ChannelEndpointElementCollection.cs
- WebBrowserHelper.cs
- TraceContextEventArgs.cs
- SqlServices.cs
- UnSafeCharBuffer.cs
- StorageConditionPropertyMapping.cs
- SerialPinChanges.cs
- ZoneButton.cs
- DoubleCollectionValueSerializer.cs
- TextFormatterHost.cs
- MenuItemCollection.cs
- ItemPager.cs
- TextEvent.cs
- HierarchicalDataBoundControl.cs
- SafeReadContext.cs
- CodeGenHelper.cs
- ControlsConfig.cs
- SqlClientPermission.cs
- ExpressionPrefixAttribute.cs
- XmlDataSource.cs
- NavigationPropertyEmitter.cs
- SecurityState.cs