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
- XmlSortKey.cs
- DocumentPageViewAutomationPeer.cs
- ExpressionVisitor.cs
- MetadataItemSerializer.cs
- ColumnMapProcessor.cs
- CapabilitiesUse.cs
- ReadOnlyObservableCollection.cs
- InvokeHandlers.cs
- XmlMtomWriter.cs
- TextPattern.cs
- Soap12ProtocolImporter.cs
- PointConverter.cs
- sqlser.cs
- XmlSerializerNamespaces.cs
- InlineObject.cs
- SafeSerializationManager.cs
- XPathDocumentIterator.cs
- SessionEndingCancelEventArgs.cs
- XPathNavigatorKeyComparer.cs
- LazyTextWriterCreator.cs
- FileSystemInfo.cs
- ServiceControllerDesigner.cs
- XslNumber.cs
- FrameworkElementAutomationPeer.cs
- Int32RectValueSerializer.cs
- Axis.cs
- CryptoKeySecurity.cs
- HtmlTable.cs
- ProgressBarBrushConverter.cs
- __FastResourceComparer.cs
- XmlElementList.cs
- SQLInt64Storage.cs
- ToolStripTemplateNode.cs
- WindowsFont.cs
- TreeNodeStyleCollection.cs
- SqlDataSourceQueryEditor.cs
- URL.cs
- SimpleApplicationHost.cs
- ControlBindingsCollection.cs
- InheritedPropertyChangedEventArgs.cs
- LinqDataSourceSelectEventArgs.cs
- WindowsListViewGroupHelper.cs
- MsmqActivation.cs
- PinnedBufferMemoryStream.cs
- PerfCounterSection.cs
- HttpListener.cs
- SizeF.cs
- NamedPipeTransportBindingElement.cs
- EntryWrittenEventArgs.cs
- CompiledAction.cs
- ActivityCompletionCallbackWrapper.cs
- glyphs.cs
- UnauthorizedAccessException.cs
- TypeSemantics.cs
- DataGridState.cs
- CharStorage.cs
- PrintPreviewDialog.cs
- Function.cs
- Control.cs
- AnimationException.cs
- ipaddressinformationcollection.cs
- DelegatingTypeDescriptionProvider.cs
- JsonReaderDelegator.cs
- TreeNodeConverter.cs
- GestureRecognizer.cs
- DependencyPropertyAttribute.cs
- FilteredAttributeCollection.cs
- HelpInfo.cs
- EntityObject.cs
- CodeAttributeArgument.cs
- TextParentUndoUnit.cs
- SessionParameter.cs
- UnsettableComboBox.cs
- Interlocked.cs
- TagPrefixAttribute.cs
- FileDialogCustomPlacesCollection.cs
- WizardStepBase.cs
- ConsoleKeyInfo.cs
- EmptyReadOnlyDictionaryInternal.cs
- VirtualPathUtility.cs
- SchemaInfo.cs
- BoundField.cs
- DBCSCodePageEncoding.cs
- ControlFilterExpression.cs
- BuildProviderInstallComponent.cs
- WebBrowserEvent.cs
- WebPartZoneCollection.cs
- BuildManager.cs
- XmlIterators.cs
- AudioException.cs
- DataGridColumnHeaderItemAutomationPeer.cs
- CodeTypeDeclarationCollection.cs
- PersonalizationProviderHelper.cs
- ObjectManager.cs
- FactoryRecord.cs
- UnmanagedMarshal.cs
- QueueProcessor.cs
- MsdtcClusterUtils.cs
- CompensateDesigner.cs
- SuppressIldasmAttribute.cs