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
- ConditionedDesigner.cs
- AutoScrollHelper.cs
- PreservationFileWriter.cs
- AsyncCompletedEventArgs.cs
- ProtocolsConfiguration.cs
- BoundField.cs
- ArraySegment.cs
- FieldToken.cs
- MultiPageTextView.cs
- WebPartConnectionsCancelVerb.cs
- PointConverter.cs
- TransformValueSerializer.cs
- ImpersonateTokenRef.cs
- PersistChildrenAttribute.cs
- ReliableSessionBindingElementImporter.cs
- TokenizerHelper.cs
- IteratorDescriptor.cs
- IDispatchConstantAttribute.cs
- SemanticValue.cs
- NameValueSectionHandler.cs
- EntitySet.cs
- DockPattern.cs
- CircleHotSpot.cs
- AlternationConverter.cs
- TypeToStringValueConverter.cs
- BadImageFormatException.cs
- BaseComponentEditor.cs
- ChildTable.cs
- SapiRecognizer.cs
- Baml2006Reader.cs
- DataObjectCopyingEventArgs.cs
- PropertySourceInfo.cs
- XhtmlTextWriter.cs
- MouseGestureValueSerializer.cs
- ScriptServiceAttribute.cs
- EntityUtil.cs
- XamlRtfConverter.cs
- RowCache.cs
- BooleanSwitch.cs
- FullTextLine.cs
- ExpressionBuilder.cs
- AttributeUsageAttribute.cs
- SafeTokenHandle.cs
- NameValueSectionHandler.cs
- ObjectQueryProvider.cs
- XamlSerializerUtil.cs
- XmlDataProvider.cs
- SqlLiftWhereClauses.cs
- SecurityUtils.cs
- GlobalProxySelection.cs
- RawAppCommandInputReport.cs
- PageThemeBuildProvider.cs
- TraceHwndHost.cs
- EndpointAddressElementBase.cs
- ExpressionWriter.cs
- FileVersionInfo.cs
- StackOverflowException.cs
- AdornerHitTestResult.cs
- DictionaryItemsCollection.cs
- ReaderWriterLockWrapper.cs
- SendActivity.cs
- DynamicQueryableWrapper.cs
- DataGridViewCellStyleChangedEventArgs.cs
- WmlMobileTextWriter.cs
- EntityViewGenerator.cs
- SqlConnectionHelper.cs
- OleCmdHelper.cs
- DataViewManagerListItemTypeDescriptor.cs
- LogAppendAsyncResult.cs
- ScriptManagerProxy.cs
- GenericIdentity.cs
- DataObject.cs
- XmlSchemaImporter.cs
- MetadataCache.cs
- WriterOutput.cs
- IntSecurity.cs
- Compress.cs
- PropertiesTab.cs
- DiffuseMaterial.cs
- MaterialGroup.cs
- SystemWebExtensionsSectionGroup.cs
- BinaryUtilClasses.cs
- BidirectionalDictionary.cs
- InstanceCompleteException.cs
- LambdaReference.cs
- WebPartMenu.cs
- ColorContext.cs
- XmlSchemaDocumentation.cs
- ScriptDescriptor.cs
- ElementUtil.cs
- MemoryFailPoint.cs
- FastEncoderWindow.cs
- IMembershipProvider.cs
- WmiPutTraceRecord.cs
- HttpBindingExtension.cs
- SplitContainer.cs
- MergablePropertyAttribute.cs
- XamlParser.cs
- GridViewSortEventArgs.cs
- MediaScriptCommandRoutedEventArgs.cs