Code:
/ Dotnetfx_Vista_SP2 / Dotnetfx_Vista_SP2 / 8.0.50727.4016 / DEVDIV / depot / DevDiv / releases / whidbey / NetFxQFE / 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
- ProxyHelper.cs
- QueryContext.cs
- handlecollector.cs
- TextEffect.cs
- DrawingImage.cs
- PackageStore.cs
- WindowsIdentity.cs
- Classification.cs
- TagMapInfo.cs
- BoundsDrawingContextWalker.cs
- FrugalMap.cs
- InvariantComparer.cs
- StructuralComparisons.cs
- QuaternionRotation3D.cs
- GregorianCalendar.cs
- Logging.cs
- GZipStream.cs
- DataFormat.cs
- UrlMapping.cs
- ServiceInfo.cs
- ClientSettings.cs
- OletxVolatileEnlistment.cs
- BamlBinaryReader.cs
- RelatedImageListAttribute.cs
- CngProvider.cs
- UserThread.cs
- HttpCapabilitiesEvaluator.cs
- SafeFileMappingHandle.cs
- SizeChangedEventArgs.cs
- Helpers.cs
- LineUtil.cs
- Frame.cs
- ConnectionConsumerAttribute.cs
- DetailsViewCommandEventArgs.cs
- SafeFileMappingHandle.cs
- TextTreeUndoUnit.cs
- OdbcPermission.cs
- CompiledQueryCacheEntry.cs
- MemberInitExpression.cs
- SqlReferenceCollection.cs
- DbProviderFactory.cs
- EditingMode.cs
- XmlNode.cs
- DataGridCell.cs
- InvalidDataException.cs
- IChannel.cs
- ImagingCache.cs
- RemotingConfigParser.cs
- TcpStreams.cs
- DrawingContextWalker.cs
- DynamicActivityProperty.cs
- HeaderedItemsControl.cs
- TemplateBamlRecordReader.cs
- MaskInputRejectedEventArgs.cs
- LateBoundBitmapDecoder.cs
- SelectManyQueryOperator.cs
- CodeValidator.cs
- FillErrorEventArgs.cs
- AdapterDictionary.cs
- OuterGlowBitmapEffect.cs
- Keywords.cs
- ClientConfigurationHost.cs
- coordinator.cs
- SelectionItemPattern.cs
- PagesSection.cs
- XPathChildIterator.cs
- IdentityReference.cs
- XmlAutoDetectWriter.cs
- XmlCustomFormatter.cs
- Page.cs
- MachineKeySection.cs
- Literal.cs
- CreateBookmarkScope.cs
- CssStyleCollection.cs
- SystemColors.cs
- DeleteCardRequest.cs
- SimpleTypeResolver.cs
- SecondaryIndexDefinition.cs
- DtdParser.cs
- ManifestResourceInfo.cs
- FileIOPermission.cs
- IRCollection.cs
- MenuAdapter.cs
- QueryModel.cs
- UInt64.cs
- ListControl.cs
- FormViewInsertEventArgs.cs
- SqlUnionizer.cs
- FunctionImportMapping.ReturnTypeRenameMapping.cs
- StructuralCache.cs
- Annotation.cs
- DataControlFieldCell.cs
- CancellationState.cs
- DataViewSetting.cs
- HMACRIPEMD160.cs
- UserControlBuildProvider.cs
- UIElement3D.cs
- SafeRegistryKey.cs
- RotateTransform.cs
- AndCondition.cs