Code:
/ Dotnetfx_Win7_3.5.1 / Dotnetfx_Win7_3.5.1 / 3.5.1 / DEVDIV / depot / DevDiv / releases / whidbey / NetFXspW7 / 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
- StringToken.cs
- PartialClassGenerationTask.cs
- Barrier.cs
- SharedConnectionWorkflowTransactionService.cs
- GeneralTransform2DTo3DTo2D.cs
- InfocardInteractiveChannelInitializer.cs
- ControlCollection.cs
- WebBrowserUriTypeConverter.cs
- SHA1.cs
- RoutedEventHandlerInfo.cs
- ConfigUtil.cs
- MessageProtectionOrder.cs
- Type.cs
- Color.cs
- SmiEventStream.cs
- DbSourceParameterCollection.cs
- ZipIOCentralDirectoryFileHeader.cs
- ReflectionServiceProvider.cs
- EncoderReplacementFallback.cs
- PrintPageEvent.cs
- ProvidePropertyAttribute.cs
- TemplateBuilder.cs
- SupportingTokenBindingElement.cs
- HtmlContainerControl.cs
- PageCatalogPart.cs
- GridLength.cs
- XmlCompatibilityReader.cs
- DrawTreeNodeEventArgs.cs
- Accessible.cs
- PopOutPanel.cs
- TrackingStringDictionary.cs
- sitestring.cs
- StatusBarDesigner.cs
- AlternateView.cs
- KnownBoxes.cs
- StackBuilderSink.cs
- ModelItem.cs
- BitmapInitialize.cs
- BoundingRectTracker.cs
- ConfigXmlSignificantWhitespace.cs
- DataTableNewRowEvent.cs
- EmptyEnumerator.cs
- MaterialCollection.cs
- SplitContainer.cs
- Odbc32.cs
- EventProvider.cs
- SqlError.cs
- Ticks.cs
- NameValueFileSectionHandler.cs
- CatalogPart.cs
- ClientApiGenerator.cs
- BroadcastEventHelper.cs
- ListViewDeletedEventArgs.cs
- ParameterBuilder.cs
- SqlComparer.cs
- PropertyStore.cs
- CardSpacePolicyElement.cs
- COM2ExtendedUITypeEditor.cs
- Transform3DGroup.cs
- BitSet.cs
- MarshalByRefObject.cs
- WinEventTracker.cs
- KeyValuePairs.cs
- BaseDataList.cs
- Int16Converter.cs
- WebServiceTypeData.cs
- ClonableStack.cs
- TextBoxRenderer.cs
- Not.cs
- DeflateEmulationStream.cs
- XamlStyleSerializer.cs
- HostedHttpContext.cs
- OleDbException.cs
- Size.cs
- WebPartChrome.cs
- SqlDataReader.cs
- HtmlDocument.cs
- NumericUpDownAccelerationCollection.cs
- IpcChannelHelper.cs
- ExplicitDiscriminatorMap.cs
- datacache.cs
- _CookieModule.cs
- ObjectStateManagerMetadata.cs
- NominalTypeEliminator.cs
- IdentityHolder.cs
- StringHandle.cs
- DataGridViewRowHeaderCell.cs
- BackgroundFormatInfo.cs
- EdmMember.cs
- NonSerializedAttribute.cs
- BufferedStream.cs
- BigInt.cs
- X509Extension.cs
- DecimalConverter.cs
- SqlDataSourceSelectingEventArgs.cs
- MetadataStore.cs
- Viewport3DAutomationPeer.cs
- XPathSelfQuery.cs
- SiteOfOriginPart.cs
- CodeTypeDelegate.cs