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
- unsafenativemethodstextservices.cs
- ListBoxItemWrapperAutomationPeer.cs
- PrimitiveDataContract.cs
- GridLength.cs
- URLMembershipCondition.cs
- WmlFormAdapter.cs
- DataTableTypeConverter.cs
- ProfileGroupSettings.cs
- TextDecorationLocationValidation.cs
- SqlColumnizer.cs
- UnsafeNativeMethodsMilCoreApi.cs
- SerTrace.cs
- IsolatedStoragePermission.cs
- OdbcConnection.cs
- DllNotFoundException.cs
- DataGridViewColumnHeaderCell.cs
- DataGridClipboardHelper.cs
- SoapReflectionImporter.cs
- FullTextBreakpoint.cs
- ConstructorExpr.cs
- WebScriptMetadataMessageEncoderFactory.cs
- InputLanguageProfileNotifySink.cs
- WpfGeneratedKnownProperties.cs
- WindowsFormsDesignerOptionService.cs
- HiddenField.cs
- PageContentCollection.cs
- CorePropertiesFilter.cs
- PreviewControlDesigner.cs
- SupportingTokenSpecification.cs
- XMLDiffLoader.cs
- OleDbConnectionPoolGroupProviderInfo.cs
- XmlILIndex.cs
- BindingCollection.cs
- ImageDrawing.cs
- DesignerAutoFormatCollection.cs
- InternalPolicyElement.cs
- GridProviderWrapper.cs
- Base64Decoder.cs
- OraclePermission.cs
- ReflectPropertyDescriptor.cs
- PageHandlerFactory.cs
- FunctionDetailsReader.cs
- CheckBox.cs
- DeclarativeCatalogPartDesigner.cs
- RangeValidator.cs
- AssemblyBuilder.cs
- HuffmanTree.cs
- XmlDataSource.cs
- CounterSample.cs
- ColumnClickEvent.cs
- FaultDesigner.cs
- WebPartTransformerAttribute.cs
- EntityDataSourceChangingEventArgs.cs
- FontUnitConverter.cs
- DiscoveryDocument.cs
- UnmanagedMemoryStreamWrapper.cs
- HtmlHead.cs
- ReadOnlyDataSourceView.cs
- SqlUdtInfo.cs
- GradientSpreadMethodValidation.cs
- ToolStripPanelRenderEventArgs.cs
- SessionStateContainer.cs
- SqlRowUpdatingEvent.cs
- _NegotiateClient.cs
- WindowsRebar.cs
- Registry.cs
- ListViewDataItem.cs
- TypeDependencyAttribute.cs
- CheckBoxStandardAdapter.cs
- FontDriver.cs
- SafeRegistryKey.cs
- SimpleExpression.cs
- TdsParserStaticMethods.cs
- Encoding.cs
- __Filters.cs
- ServiceDescriptionReflector.cs
- PcmConverter.cs
- TdsParserSafeHandles.cs
- Popup.cs
- XmlSchemaAll.cs
- DataTable.cs
- EventMappingSettingsCollection.cs
- MembershipPasswordException.cs
- Panel.cs
- TimeManager.cs
- DbMetaDataColumnNames.cs
- ItemCollection.cs
- HeaderUtility.cs
- Graph.cs
- AccessedThroughPropertyAttribute.cs
- PrimarySelectionGlyph.cs
- WithStatement.cs
- EntityDesignerDataSourceView.cs
- BitmapEffectGeneralTransform.cs
- CompositeDataBoundControl.cs
- NativeRightsManagementAPIsStructures.cs
- ZoomPercentageConverter.cs
- UnsafeNativeMethodsMilCoreApi.cs
- FlowDocumentScrollViewerAutomationPeer.cs
- Content.cs