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
- WasHttpModulesInstallComponent.cs
- ReceiveContent.cs
- DataGridViewHitTestInfo.cs
- EntityDesignerBuildProvider.cs
- assertwrapper.cs
- PropertyConverter.cs
- Image.cs
- DynamicControlParameter.cs
- BmpBitmapDecoder.cs
- RichTextBoxDesigner.cs
- IProvider.cs
- ExpressionParser.cs
- EventItfInfo.cs
- log.cs
- WindowManager.cs
- TreeNodeStyleCollection.cs
- Wizard.cs
- Literal.cs
- PropertyTab.cs
- SplayTreeNode.cs
- FilteredAttributeCollection.cs
- IsolatedStorage.cs
- FailedToStartupUIException.cs
- OleDbConnection.cs
- RootBrowserWindowProxy.cs
- WebRequestModuleElementCollection.cs
- TextParagraphView.cs
- Errors.cs
- Number.cs
- ProgressBarRenderer.cs
- ProgressBarRenderer.cs
- WebRequestModulesSection.cs
- PartialCachingControl.cs
- WebPartManager.cs
- WorkflowOperationAsyncResult.cs
- OdbcFactory.cs
- ServicePerformanceCounters.cs
- WinEventTracker.cs
- CollectionViewGroupInternal.cs
- HtmlControlPersistable.cs
- FormViewDeleteEventArgs.cs
- CachedTypeface.cs
- ServiceMemoryGates.cs
- TransformerInfoCollection.cs
- PrincipalPermission.cs
- PartEditor.cs
- EntityCommandExecutionException.cs
- EventEntry.cs
- FormView.cs
- TextStore.cs
- DoubleAnimationBase.cs
- ResourceSet.cs
- SafeSecurityHandles.cs
- PropertyChange.cs
- XmlChildEnumerator.cs
- RawUIStateInputReport.cs
- DelegateArgument.cs
- InvokeMethodDesigner.xaml.cs
- Compiler.cs
- ConfigXmlElement.cs
- MaskedTextProvider.cs
- SoundPlayer.cs
- HashLookup.cs
- StaticSiteMapProvider.cs
- ProcessModelInfo.cs
- BrushConverter.cs
- activationcontext.cs
- RSAOAEPKeyExchangeFormatter.cs
- ListenerAdaptersInstallComponent.cs
- ContentFileHelper.cs
- ToolStripContentPanelRenderEventArgs.cs
- EncryptedReference.cs
- SynchronizedDispatch.cs
- SymLanguageVendor.cs
- IPipelineRuntime.cs
- ViewSimplifier.cs
- VSWCFServiceContractGenerator.cs
- TextEditorDragDrop.cs
- Root.cs
- SimplePropertyEntry.cs
- ServiceHostingEnvironmentSection.cs
- PropertiesTab.cs
- Object.cs
- DataTable.cs
- DoubleAnimationClockResource.cs
- VariableQuery.cs
- InputBindingCollection.cs
- SoapExtensionTypeElementCollection.cs
- ComponentResourceManager.cs
- QilIterator.cs
- WpfXamlLoader.cs
- xdrvalidator.cs
- NativeWindow.cs
- EFDataModelProvider.cs
- TextClipboardData.cs
- ToolboxDataAttribute.cs
- DateTimeStorage.cs
- SubordinateTransaction.cs
- PropertyEmitter.cs
- FlowPosition.cs