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
- SqlUtil.cs
- ByteStream.cs
- ListViewPagedDataSource.cs
- HashCryptoHandle.cs
- CatalogPartCollection.cs
- WindowsScroll.cs
- HtmlInputHidden.cs
- InteropBitmapSource.cs
- GridEntry.cs
- PixelShader.cs
- ResponseStream.cs
- AbsoluteQuery.cs
- XmlIterators.cs
- KeyGesture.cs
- Header.cs
- ControlBuilder.cs
- FrameworkContentElement.cs
- sqlnorm.cs
- Group.cs
- DataDocumentXPathNavigator.cs
- HitTestWithPointDrawingContextWalker.cs
- ArrangedElementCollection.cs
- ClientScriptManager.cs
- xdrvalidator.cs
- FloaterBaseParagraph.cs
- HtmlTableCell.cs
- ItemsChangedEventArgs.cs
- BasePattern.cs
- ContextMenu.cs
- DbConnectionStringCommon.cs
- NativeCppClassAttribute.cs
- Select.cs
- RichTextBox.cs
- ControlCachePolicy.cs
- StaticSiteMapProvider.cs
- TransactionChannelFaultConverter.cs
- IgnoreFlushAndCloseStream.cs
- TypeDescriptorFilterService.cs
- ItemCheckedEvent.cs
- OleDbCommand.cs
- EmissiveMaterial.cs
- RelationshipManager.cs
- SiteMapProvider.cs
- EntityDataSourceContextCreatingEventArgs.cs
- ContextQuery.cs
- DataGridViewColumnHeaderCell.cs
- HandleExceptionArgs.cs
- IPAddressCollection.cs
- BooleanKeyFrameCollection.cs
- DataGridViewCell.cs
- Drawing.cs
- RegexReplacement.cs
- StreamWithDictionary.cs
- DayRenderEvent.cs
- EntitySetBase.cs
- EntityDataSource.cs
- TableColumn.cs
- MediaCommands.cs
- ReachIDocumentPaginatorSerializer.cs
- MembershipUser.cs
- DependencyObjectType.cs
- WebPartEditorOkVerb.cs
- SafeNativeMethods.cs
- DecoderReplacementFallback.cs
- DataGridViewCellCancelEventArgs.cs
- Int64.cs
- TextBoxBase.cs
- ImageMapEventArgs.cs
- SqlRowUpdatedEvent.cs
- Italic.cs
- HtmlMobileTextWriter.cs
- GlyphElement.cs
- StoreAnnotationsMap.cs
- ReferenceCountedObject.cs
- DefaultCommandConverter.cs
- _NetworkingPerfCounters.cs
- AssemblySettingAttributes.cs
- SqlNodeTypeOperators.cs
- Utils.cs
- CodeMemberField.cs
- ValidationHelper.cs
- PersistenceProviderFactory.cs
- ChtmlLinkAdapter.cs
- EventDescriptorCollection.cs
- CookieParameter.cs
- ValueSerializer.cs
- DescendantBaseQuery.cs
- XmlAttributes.cs
- MailBnfHelper.cs
- WindowsGraphicsCacheManager.cs
- SendMailErrorEventArgs.cs
- WebZone.cs
- EpmContentDeSerializer.cs
- QilPatternVisitor.cs
- GPPOINTF.cs
- StringOutput.cs
- LinqDataSourceView.cs
- AnimatedTypeHelpers.cs
- ObjectListDataBindEventArgs.cs
- ModelTreeManager.cs