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
- SHA256Managed.cs
- GAC.cs
- UniqueConstraint.cs
- PKCS1MaskGenerationMethod.cs
- ControllableStoryboardAction.cs
- ShapingEngine.cs
- EventWaitHandleSecurity.cs
- CodeObjectCreateExpression.cs
- SqlDataRecord.cs
- DataGridViewCheckBoxCell.cs
- TableDetailsCollection.cs
- UriWriter.cs
- KoreanCalendar.cs
- OpenFileDialog.cs
- LineBreak.cs
- PeerServiceMessageContracts.cs
- XmlBindingWorker.cs
- DefaultAsyncDataDispatcher.cs
- XDRSchema.cs
- TraceShell.cs
- COAUTHINFO.cs
- XmlDictionaryReader.cs
- ToolTipService.cs
- Composition.cs
- SQLGuidStorage.cs
- RTLAwareMessageBox.cs
- DodSequenceMerge.cs
- DocumentOrderQuery.cs
- Item.cs
- PageThemeParser.cs
- CodeTypeReferenceExpression.cs
- HMAC.cs
- ComplusTypeValidator.cs
- TemplatePropertyEntry.cs
- AnnotationDocumentPaginator.cs
- TabControlCancelEvent.cs
- ScrollChrome.cs
- XmlNodeList.cs
- UndirectedGraph.cs
- TextRangeBase.cs
- DataGridTextBoxColumn.cs
- MultiByteCodec.cs
- SQLBinary.cs
- JsonFormatReaderGenerator.cs
- PropertyTabAttribute.cs
- CancellableEnumerable.cs
- EntityClassGenerator.cs
- CodeMemberProperty.cs
- DescendentsWalkerBase.cs
- BinaryFormatterWriter.cs
- WindowsUserNameCachingSecurityTokenAuthenticator.cs
- JsonQueryStringConverter.cs
- _TimerThread.cs
- DelegatingTypeDescriptionProvider.cs
- UpdatableGenericsFeature.cs
- DragDrop.cs
- GeneralTransformGroup.cs
- XmlSchemaSimpleTypeList.cs
- ProfileBuildProvider.cs
- CharConverter.cs
- UpdateRecord.cs
- TextInfo.cs
- SqlConnectionStringBuilder.cs
- CodeCompiler.cs
- AstTree.cs
- RowsCopiedEventArgs.cs
- WebPartVerb.cs
- DetailsViewUpdateEventArgs.cs
- LoginView.cs
- __Filters.cs
- WorkerRequest.cs
- SerializableTypeCodeDomSerializer.cs
- streamingZipPartStream.cs
- MonitoringDescriptionAttribute.cs
- PingOptions.cs
- FixUp.cs
- MailWebEventProvider.cs
- UpdateCompiler.cs
- MaterializeFromAtom.cs
- ProfileSettings.cs
- StrokeIntersection.cs
- FindCompletedEventArgs.cs
- SqlDuplicator.cs
- StringValidator.cs
- DataGridViewColumnStateChangedEventArgs.cs
- ReachSerializationUtils.cs
- HuffModule.cs
- TransformProviderWrapper.cs
- HierarchicalDataSourceDesigner.cs
- TypefaceMap.cs
- RemoteWebConfigurationHostStream.cs
- ConfigurationSection.cs
- ImpersonateTokenRef.cs
- ClientSettings.cs
- RSATokenProvider.cs
- Table.cs
- AnalyzedTree.cs
- WizardStepBase.cs
- ContentValidator.cs
- Triangle.cs