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
- HttpChannelHelpers.cs
- RoutedUICommand.cs
- View.cs
- DataSetUtil.cs
- XmlSignatureManifest.cs
- ContextMenuService.cs
- PinnedBufferMemoryStream.cs
- WebResourceUtil.cs
- ResourceReferenceExpressionConverter.cs
- SessionStateContainer.cs
- ParameterCollectionEditor.cs
- ApplicationDirectoryMembershipCondition.cs
- MimeObjectFactory.cs
- DisplayMemberTemplateSelector.cs
- FileLevelControlBuilderAttribute.cs
- DataGridViewCellValueEventArgs.cs
- ConstNode.cs
- TextBoxBase.cs
- EdmItemError.cs
- ModuleBuilder.cs
- SelectManyQueryOperator.cs
- TreeBuilder.cs
- UMPAttributes.cs
- ScriptResourceMapping.cs
- FocusTracker.cs
- OutputCacheProfileCollection.cs
- OdbcEnvironmentHandle.cs
- WorkflowApplicationCompletedException.cs
- URL.cs
- CompleteWizardStep.cs
- PassportAuthenticationEventArgs.cs
- SafeEventLogWriteHandle.cs
- ForceCopyBuildProvider.cs
- ListViewUpdatedEventArgs.cs
- MultiViewDesigner.cs
- BindingExpression.cs
- SocketException.cs
- LoginView.cs
- DistributedTransactionPermission.cs
- COAUTHINFO.cs
- WizardStepBase.cs
- XNodeNavigator.cs
- PropertyPushdownHelper.cs
- ServiceChannelProxy.cs
- CommonDialog.cs
- ToolStripDropDownButton.cs
- TransportListener.cs
- WebPartCatalogAddVerb.cs
- TakeOrSkipWhileQueryOperator.cs
- LicenseProviderAttribute.cs
- ProtocolsConfiguration.cs
- WindowsAltTab.cs
- Matrix3D.cs
- StartUpEventArgs.cs
- HMACSHA1.cs
- PageParserFilter.cs
- Buffer.cs
- FileDialog.cs
- _Win32.cs
- ProviderManager.cs
- DataGridItemEventArgs.cs
- ToolBar.cs
- RegisteredDisposeScript.cs
- RegexCharClass.cs
- AttachInfo.cs
- DynamicQueryableWrapper.cs
- CompilerGeneratedAttribute.cs
- EdmSchemaError.cs
- ReachPageContentCollectionSerializer.cs
- EventWaitHandle.cs
- AspProxy.cs
- ScriptControl.cs
- DataGridViewTextBoxCell.cs
- DataBinding.cs
- SqlAliasesReferenced.cs
- ListDictionary.cs
- SettingsPropertyIsReadOnlyException.cs
- Reference.cs
- XPathDocumentNavigator.cs
- XsdBuilder.cs
- RowUpdatedEventArgs.cs
- DataBindingCollection.cs
- CodeCatchClauseCollection.cs
- RadioButtonAutomationPeer.cs
- DataGridViewButtonColumn.cs
- XsltContext.cs
- BindUriHelper.cs
- Restrictions.cs
- QueryExtender.cs
- ManifestSignedXml.cs
- GlyphRunDrawing.cs
- KeyValuePairs.cs
- DynamicValidatorEventArgs.cs
- GenericWebPart.cs
- TextTreeInsertElementUndoUnit.cs
- WindowsFormsLinkLabel.cs
- HttpCacheVary.cs
- PhoneCall.cs
- XmlNodeChangedEventArgs.cs
- DataGridLinkButton.cs