Code:
/ Net / Net / 3.5.50727.3053 / DEVDIV / depot / DevDiv / releases / whidbey / netfxsp / ndp / fx / src / Data / System / Data / Odbc / OdbcParameterCollection.cs / 1 / OdbcParameterCollection.cs
//------------------------------------------------------------------------------ //// Copyright (c) Microsoft Corporation. All rights reserved. // //[....] //[....] //----------------------------------------------------------------------------- namespace System.Data.Odbc { using System; using System.Collections; using System.ComponentModel; using System.Data; using System.Data.Common; using System.Data.ProviderBase; using System.Diagnostics; using System.Runtime.InteropServices; [ Editor("Microsoft.VSDesigner.Data.Design.DBParametersEditor, " + AssemblyRef.MicrosoftVSDesigner, "System.Drawing.Design.UITypeEditor, " + AssemblyRef.SystemDrawing), ListBindable(false) ] #if WINFSInternalOnly internal #else public #endif sealed partial class OdbcParameterCollection : DbParameterCollection { private bool _rebindCollection; // The collection needs to be (re)bound private static Type ItemType = typeof(OdbcParameter); internal OdbcParameterCollection() : base() { } internal bool RebindCollection { get { return _rebindCollection; } set { _rebindCollection = value; } } [ Browsable(false), DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden) ] new public OdbcParameter this[int index] { get { return (OdbcParameter)GetParameter(index); } set { SetParameter(index, value); } } [ Browsable(false), DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden) ] new public OdbcParameter this[string parameterName] { get { return (OdbcParameter)GetParameter(parameterName); } set { SetParameter(parameterName, value); } } public OdbcParameter Add(OdbcParameter value) { // MDAC 59206 Add((object)value); return value; } [ EditorBrowsableAttribute(EditorBrowsableState.Never)] [ ObsoleteAttribute("Add(String parameterName, Object value) has been deprecated. Use AddWithValue(String parameterName, Object value). http://go.microsoft.com/fwlink/?linkid=14202", false) ] // 79027 public OdbcParameter Add(string parameterName, object value) { // MDAC 59206 return Add(new OdbcParameter(parameterName, value)); } public OdbcParameter AddWithValue(string parameterName, object value) { // MDAC 79027 return Add(new OdbcParameter(parameterName, value)); } public OdbcParameter Add(string parameterName, OdbcType odbcType) { return Add(new OdbcParameter(parameterName, odbcType)); } public OdbcParameter Add(string parameterName, OdbcType odbcType, int size) { return Add(new OdbcParameter(parameterName, odbcType, size)); } public OdbcParameter Add(string parameterName, OdbcType odbcType, int size, string sourceColumn) { return Add(new OdbcParameter(parameterName, odbcType, size, sourceColumn)); } public void AddRange(OdbcParameter[] values) { // V1.2.3300 AddRange((Array)values); } // Walks through the collection and binds each parameter // internal void Bind(OdbcCommand command, CMDWrapper cmdWrapper, CNativeBuffer parameterBuffer){ for(int i = 0; i < Count; ++i) { this[i].Bind(cmdWrapper.StatementHandle, command, checked((short)(i+1)), parameterBuffer, true); } _rebindCollection = false; } internal int CalcParameterBufferSize(OdbcCommand command){ // Calculate the size of the buffer we need int parameterBufferSize = 0; for(int i = 0; i < Count; ++i) { if (_rebindCollection) { this[i].HasChanged = true; } this[i].PrepareForBind(command, (short)(i+1), ref parameterBufferSize); parameterBufferSize = (parameterBufferSize + (IntPtr.Size-1)) & ~(IntPtr.Size-1); // align buffer; } return parameterBufferSize; } // Walks through the collection and clears the parameters // internal void ClearBindings () { for(int i = 0; i < Count; ++i) { this[i].ClearBinding(); } } override public bool Contains(string value) { // WebData 97349 return (-1 != IndexOf(value)); } public bool Contains(OdbcParameter value) { return (-1 != IndexOf(value)); } public void CopyTo(OdbcParameter[] array, int index) { CopyTo((Array)array, index); } private void OnChange() { _rebindCollection = true; } internal void GetOutputValues (CMDWrapper cmdWrapper) { // mdac 88542 - we will not read out the parameters if the collection has changed if (!_rebindCollection) { CNativeBuffer parameterBuffer = cmdWrapper._nativeParameterBuffer; for(int i = 0; i < Count; ++i) { this[i].GetOutputValue(parameterBuffer); } } } public int IndexOf(OdbcParameter value) { return IndexOf((object)value); } public void Insert(int index, OdbcParameter value) { Insert(index, (object)value); } public void Remove(OdbcParameter value) { Remove((object)value); } } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007. //------------------------------------------------------------------------------ //// Copyright (c) Microsoft Corporation. All rights reserved. // //[....] //[....] //----------------------------------------------------------------------------- namespace System.Data.Odbc { using System; using System.Collections; using System.ComponentModel; using System.Data; using System.Data.Common; using System.Data.ProviderBase; using System.Diagnostics; using System.Runtime.InteropServices; [ Editor("Microsoft.VSDesigner.Data.Design.DBParametersEditor, " + AssemblyRef.MicrosoftVSDesigner, "System.Drawing.Design.UITypeEditor, " + AssemblyRef.SystemDrawing), ListBindable(false) ] #if WINFSInternalOnly internal #else public #endif sealed partial class OdbcParameterCollection : DbParameterCollection { private bool _rebindCollection; // The collection needs to be (re)bound private static Type ItemType = typeof(OdbcParameter); internal OdbcParameterCollection() : base() { } internal bool RebindCollection { get { return _rebindCollection; } set { _rebindCollection = value; } } [ Browsable(false), DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden) ] new public OdbcParameter this[int index] { get { return (OdbcParameter)GetParameter(index); } set { SetParameter(index, value); } } [ Browsable(false), DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden) ] new public OdbcParameter this[string parameterName] { get { return (OdbcParameter)GetParameter(parameterName); } set { SetParameter(parameterName, value); } } public OdbcParameter Add(OdbcParameter value) { // MDAC 59206 Add((object)value); return value; } [ EditorBrowsableAttribute(EditorBrowsableState.Never)] [ ObsoleteAttribute("Add(String parameterName, Object value) has been deprecated. Use AddWithValue(String parameterName, Object value). http://go.microsoft.com/fwlink/?linkid=14202", false) ] // 79027 public OdbcParameter Add(string parameterName, object value) { // MDAC 59206 return Add(new OdbcParameter(parameterName, value)); } public OdbcParameter AddWithValue(string parameterName, object value) { // MDAC 79027 return Add(new OdbcParameter(parameterName, value)); } public OdbcParameter Add(string parameterName, OdbcType odbcType) { return Add(new OdbcParameter(parameterName, odbcType)); } public OdbcParameter Add(string parameterName, OdbcType odbcType, int size) { return Add(new OdbcParameter(parameterName, odbcType, size)); } public OdbcParameter Add(string parameterName, OdbcType odbcType, int size, string sourceColumn) { return Add(new OdbcParameter(parameterName, odbcType, size, sourceColumn)); } public void AddRange(OdbcParameter[] values) { // V1.2.3300 AddRange((Array)values); } // Walks through the collection and binds each parameter // internal void Bind(OdbcCommand command, CMDWrapper cmdWrapper, CNativeBuffer parameterBuffer){ for(int i = 0; i < Count; ++i) { this[i].Bind(cmdWrapper.StatementHandle, command, checked((short)(i+1)), parameterBuffer, true); } _rebindCollection = false; } internal int CalcParameterBufferSize(OdbcCommand command){ // Calculate the size of the buffer we need int parameterBufferSize = 0; for(int i = 0; i < Count; ++i) { if (_rebindCollection) { this[i].HasChanged = true; } this[i].PrepareForBind(command, (short)(i+1), ref parameterBufferSize); parameterBufferSize = (parameterBufferSize + (IntPtr.Size-1)) & ~(IntPtr.Size-1); // align buffer; } return parameterBufferSize; } // Walks through the collection and clears the parameters // internal void ClearBindings () { for(int i = 0; i < Count; ++i) { this[i].ClearBinding(); } } override public bool Contains(string value) { // WebData 97349 return (-1 != IndexOf(value)); } public bool Contains(OdbcParameter value) { return (-1 != IndexOf(value)); } public void CopyTo(OdbcParameter[] array, int index) { CopyTo((Array)array, index); } private void OnChange() { _rebindCollection = true; } internal void GetOutputValues (CMDWrapper cmdWrapper) { // mdac 88542 - we will not read out the parameters if the collection has changed if (!_rebindCollection) { CNativeBuffer parameterBuffer = cmdWrapper._nativeParameterBuffer; for(int i = 0; i < Count; ++i) { this[i].GetOutputValue(parameterBuffer); } } } public int IndexOf(OdbcParameter value) { return IndexOf((object)value); } public void Insert(int index, OdbcParameter value) { Insert(index, (object)value); } public void Remove(OdbcParameter value) { Remove((object)value); } } } // 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
- ExpressionPrefixAttribute.cs
- VirtualDirectoryMappingCollection.cs
- Message.cs
- LineInfo.cs
- BitmapEffectInputData.cs
- processwaithandle.cs
- CharacterBuffer.cs
- BaseCollection.cs
- StreamWriter.cs
- AsymmetricKeyExchangeDeformatter.cs
- SystemResourceKey.cs
- PkcsUtils.cs
- DateTimePicker.cs
- Attributes.cs
- RelationshipConstraintValidator.cs
- PersonalizableAttribute.cs
- Site.cs
- propertytag.cs
- ResourcesBuildProvider.cs
- TypedReference.cs
- DetailsViewInsertedEventArgs.cs
- SystemResources.cs
- XmlWriterSettings.cs
- MouseOverProperty.cs
- EventHandlingScope.cs
- CheckBox.cs
- StringAnimationUsingKeyFrames.cs
- ControlPropertyNameConverter.cs
- ColorKeyFrameCollection.cs
- UnsafeNativeMethods.cs
- XPathDescendantIterator.cs
- XsltOutput.cs
- DirectoryObjectSecurity.cs
- ItemContainerGenerator.cs
- ManagementExtension.cs
- RootBuilder.cs
- login.cs
- WindowCollection.cs
- DataGridLinkButton.cs
- UndoManager.cs
- Lease.cs
- SchemaLookupTable.cs
- OrCondition.cs
- ConfigXmlText.cs
- ZipIORawDataFileBlock.cs
- RemotingConfigParser.cs
- IIS7WorkerRequest.cs
- LingerOption.cs
- ListBox.cs
- ResXDataNode.cs
- WinCategoryAttribute.cs
- ParseElementCollection.cs
- FontCollection.cs
- BindingSource.cs
- GlobalEventManager.cs
- VisualCollection.cs
- AutoCompleteStringCollection.cs
- FontWeight.cs
- AutomationEventArgs.cs
- _IPv6Address.cs
- StatusBarDrawItemEvent.cs
- Module.cs
- SecurityDocument.cs
- DragEventArgs.cs
- CssStyleCollection.cs
- PathGeometry.cs
- AssemblyContextControlItem.cs
- OpCodes.cs
- TableCell.cs
- XmlHierarchicalDataSourceView.cs
- QueuePropertyVariants.cs
- EventEntry.cs
- ContentValidator.cs
- PrintingPermissionAttribute.cs
- BrowserTree.cs
- SelectionItemPattern.cs
- Vector3DCollection.cs
- Point3D.cs
- __FastResourceComparer.cs
- DataIdProcessor.cs
- HitTestWithPointDrawingContextWalker.cs
- Annotation.cs
- RtfControls.cs
- XPathNavigator.cs
- PtsHelper.cs
- FormatConvertedBitmap.cs
- DESCryptoServiceProvider.cs
- ToolStripRendererSwitcher.cs
- Visitor.cs
- StaticFileHandler.cs
- UrlMapping.cs
- DrawListViewColumnHeaderEventArgs.cs
- OleDbSchemaGuid.cs
- OrderingInfo.cs
- PixelFormat.cs
- TextTreePropertyUndoUnit.cs
- RemoteWebConfigurationHostStream.cs
- String.cs
- DataView.cs
- DispatcherObject.cs