|
if u need to call the function on button click..
<asp:button id="test" onclick="LoadItems">
Thanks,
Sun Rays
|
|
|
|
|
i want popup window like small form.
then how can i resize the webform.
Gayatri
Gayatri
|
|
|
|
|
use js function window.open(...)
I cannot remember exactly the parameters...but you can search this to specify the size of window
<< >>
|
|
|
|
|
Hi all
i am new in asp.net and
i want to resize my webform.
pls help me
Gayatri
Gayatri
|
|
|
|
|
resizing for which purpose??
|
|
|
|
|
private void SampleFunction()
{
try
{
response.redirect("somepage");
}
finally
{
response.write("finally");
response.end();
}
}
Consider the above code , in this what do you think, will finally block executes ? If not Why ?
|
|
|
|
|
Hi
Finally part will not be called as you are redirecting to some other page. If there is an exception in the try block before redirecting to that page then finally will be displayed
Harini
|
|
|
|
|
Hi All,
I have an EnvirounmentalVariable (i.e. %VsRoot%) to point to devenv.exe under 2002)---->This is in VisualStudio 2002
I need to Create a new Envirounmentalvariable (i.e. %VsRoot1%) to point to devenv.exe under 2003 .
How to create a new EnvirounmentalVariable.
Thanks to all Repliers,
|
|
|
|
|
I am not sure...but you can create env variables by right-click on My Computer...
<< >>
|
|
|
|
|
Hi Can you please tell me about the free / open source blogs available in ASP.Net 2.0
Any database will do.
Please provide links if possible.
Thanks ..
Deepak Surana
|
|
|
|
|
i want the best material for state management
|
|
|
|
|
|
|
I'm developing a fairly largish project in VS2005 sp1 (asp.net). A problem I'm having at the moment is that it intermittently displays the error
“Unable to copy file ‘obj\Debug\xxx.dll’ to ‘bin\Debug\xxx.dll’. The process cannot access the file 'bin\Debug\xxx.dll' because it is being used by another process.”
some pepole on internet tell me config in webconfig is:
<hostingenvironment shadowcopybinassemblies="false">
but it still error some body help me ????
|
|
|
|
|
Hi
Uncheck read-only of your main folder (right-click your bin folder -> click properties -> uncheck read-only if it is checked) and redo the steps again.
Harini
|
|
|
|
|
i am new to ASP.Net i have used an sqlhelper in my application for executing some of my sp's i am getting this mess while running my web application,"The ConnectionString property has not been initialized."
Thanks in advance
|
|
|
|
|
Show me your code ? Why don't you use classes in SQL Client like SQLCOnnection. SQLCommand,SQLReader etc...
|
|
|
|
|
Hi,
I alreadt have generic custom colection code developed in VB.Net couldany body pls. provide me the same code in C#.Net it is very urgent .....your help will be appreaciated.
I am copying the collection code in VB.Net below
Imports System
Imports System.Data.SqlClient
Imports System.Collections
'///
'/// A strongly-typed collection of <see cref="SqlParameter"> objects.
'///
<serializable()> _
Friend Class SqlParamCollection
Implements ICollection
Implements IList
Implements IEnumerable
Implements ICloneable
#Region "Interfaces"
'///
'/// Supports type-safe iteration over a <see cref="SqlParamCollection">.
'///
Public Interface ISqlParamCollectionEnumerator
'///
'/// Gets the current element in the collection.
'///
ReadOnly Property Current() As SqlParameter
'///
'/// Advances the enumerator to the next element in the collection.
'///
'/// <exception cref="InvalidOperationException">
'/// The collection was modified after the enumerator was created.
'///
'/// <returns>
'/// <c>true if the enumerator was successfully advanced to the next element
'/// <c>false if the enumerator has passed the end of the collection.
'///
Function MoveNext() As Boolean
'///
'/// Sets the enumerator to its initial position, before the first element in the collection.
'///
Sub Reset()
End Interface
#End Region
Private Const DEFAULT_CAPACITY As Integer = 15
#Region "Implementation (data)"
Private m_array() As SqlParameter
Private m_count As Integer = 0
<nonserialized()> _
Private m_version As Integer = 0
#End Region
#Region "Static Wrappers"
'///
'/// Creates a synchronized (thread-safe) wrapper for a
'/// <c>SqlParamCollection instance.
'///
'/// <returns>
'/// An <c>SqlParamCollection wrapper that is synchronized (thread-safe).
'///
Public Shared Function Synchronized(ByVal list As SqlParamCollection) As SqlParamCollection
If (list Is Nothing) Then
Throw New ArgumentNullException("list")
End If
Return New SyncSqlParamCollection(list)
End Function
'///
'/// Creates a read-only wrapper for a
'/// <c>SqlParamCollection instance.
'///
'/// <returns>
'/// An <c>SqlParamCollection wrapper that is read-only.
'///
Public Shared Function GetReadOnly(ByVal list As SqlParamCollection) As SqlParamCollection
If (list Is Nothing) Then
Throw New ArgumentNullException("list")
End If
Return New ReadOnlySqlParamCollection(list)
End Function
#End Region
#Region "Construction"
'///
'/// Initializes a new instance of the <c>SqlParamCollection class
'/// that is empty and has the default initial capacity.
'///
Public Sub New()
m_array = New SqlParameter(DEFAULT_CAPACITY) {}
End Sub
'///
'/// Initializes a new instance of the <c>SqlParamCollection class
'/// that has the specified initial capacity.
'///
'/// <param name="capacity" />
'/// The number of elements that the new <c>SqlParamCollection is initially capable of storing.
'///
Public Sub New(ByVal capacity As Integer)
m_array = New SqlParameter(capacity) {}
End Sub
'///
'/// Initializes a new instance of the <c>SqlParamCollection class
'/// that contains elements copied from the specified <c>SqlParamCollection.
'///
'/// <param name="c" />The <c>SqlParamCollection whose elements are copied to the new collection.
Public Sub New(ByVal c As SqlParamCollection)
m_array = New SqlParameter(c.Count) {}
AddRange(c)
End Sub
'///
'/// Initializes a new instance of the <c>SqlParamCollection class
'/// that contains elements copied from the specified <see cref="SqlParameter"> array.
'///
'/// <param name="a" />The <see cref="SqlParameter"> array whose elements are copied to the new list.
Public Sub New(ByVal a() As SqlParameter)
m_array = New SqlParameter(a.Length) {}
AddRange(a)
End Sub
#End Region
#Region "Operations (type-safe ICollection)"
'///
'/// Gets the number of elements actually contained in the <c>SqlParamCollection.
'///
Public Overridable ReadOnly Property Count() As Integer Implements ICollection.Count
Get
Return m_count
End Get
End Property
'///
'/// Copies the entire <c>SqlParamCollection to a one-dimensional
'/// <see cref="SqlParameter"> array.
'///
'/// <param name="array" />The one-dimensional <see cref="SqlParameter"> array to copy to.
Public Overridable Sub CopyTo(ByVal array() As SqlParameter)
Me.CopyTo(array, 0)
End Sub
'///
'/// Copies the entire <c>SqlParamCollection to a one-dimensional
'/// <see cref="SqlParameter"> array, starting at the specified index of the target array.
'///
'/// <param name="array" />The one-dimensional <see cref="SqlParameter"> array to copy to.
'/// <param name="start" />The zero-based index in <paramref name="array"> at which copying begins.
Public Overridable Sub CopyTo(ByVal array() As SqlParameter, ByVal start As Integer)
If (m_count > (array.GetUpperBound(0) + 1 - start)) Then
Throw New System.ArgumentException("Destination array was not long enough.")
End If
array.Copy(m_array, 0, array, start, m_count)
End Sub
'///
'/// Gets a value indicating whether access to the collection is synchronized (thread-safe).
'///
'/// <returns>true if access to the ICollection is synchronized (thread-safe) otherwise, false.
Public Overridable ReadOnly Property IsSynchronized() As Boolean Implements ICollection.IsSynchronized
Get
Return m_array.IsSynchronized
End Get
End Property
'///
'/// Gets an object that can be used to synchronize access to the collection.
'///
Public Overridable ReadOnly Property SyncRoot() As Object Implements ICollection.SyncRoot
Get
Return m_array.SyncRoot
End Get
End Property
#End Region
#Region "Operations (type-safe IList)"
'///
'/// Gets or sets the <see cref="SqlParameter"> at the specified index.
'///
'/// <param name="index" />The zero-based index of the element to get or set.
'/// <exception cref="ArgumentOutOfRangeException">
'/// <para><paramref name="index"> is less than zero
'/// <para>-or-
'/// <para><paramref name="index"> is equal to or greater than <see cref="SqlParamCollection.Count">.
'///
Default Public Overridable Property Item(ByVal index As Integer) As SqlParameter
Get
ValidateIndex(index) '// throws
Return m_array(index)
End Get
Set(ByVal Value As SqlParameter)
ValidateIndex(index) '// throws
m_version += 1
m_array(index) = Value
End Set
End Property
'///
'/// Gets or sets the <see cref="SqlParameter"> with the specified key.
'///
'/// <param name="key" />The name of the element to get or set.
'/// <exception cref="ArgumentException">
'///
Default Public Overridable Property Item(ByVal key As String) As SqlParameter
Get
Dim index As Integer
index = FindItem(key) '// throws
Return m_array(index)
End Get
Set(ByVal Value As SqlParameter)
Dim index As Integer
index = FindItem(key) '// throws
m_version += 1
m_array(index) = Value
End Set
End Property
'///
'/// Adds a <see cref="SqlParameter"> to the end of the <c>SqlParamCollection.
'///
'/// <param name="item" />The <see cref="SqlParameter"> to be added to the end of the <c>SqlParamCollection.
'/// <returns>The index at which the value has been added.
Public Overridable Function Add(ByVal item As SqlParameter) As Integer
If (m_count = m_array.Length) Then
EnsureCapacity(m_count + 1)
End If
m_array(m_count) = item
m_version += 1
m_count += 1
Return (m_count - 1)
End Function
'///
'/// Removes all elements from the <c>SqlParamCollection.
'///
Public Overridable Sub Clear() Implements IList.Clear
m_version += 1
m_array = New SqlParameter(DEFAULT_CAPACITY) {}
m_count = 0
End Sub
'///
'/// Creates a shallow copy of the <see cref="SqlParamCollection">.
'///
Public Overridable Function Clone() As Object Implements ICloneable.Clone
Dim newColl As SqlParamCollection = New SqlParamCollection(m_count)
Array.Copy(m_array, 0, newColl.m_array, 0, m_count)
newColl.m_count = m_count
newColl.m_version = m_version
Return newColl
End Function
'///
'/// Determines whether a given <see cref="SqlParameter"> is in the <c>SqlParamCollection.
'///
'/// <param name="item" />The <see cref="SqlParameter"> to check for.
'/// <returns><c>true if <paramref name="item"> is found in the <c>SqlParamCollection otherwise, <c>false.
Public Overridable Function Contains(ByVal item As SqlParameter) As Boolean
Dim i As Integer
For i = 0 To (m_count - 1) Step 1
If (m_array(i).Equals(item)) Then
Return True
End If
Next
Return False
End Function
'///
'/// Returns the zero-based index of the first occurrence of a <see cref="SqlParameter">
'/// in the <c>SqlParamCollection.
'///
'/// <param name="item" />The <see cref="SqlParameter"> to locate in the <c>SqlParamCollection.
'/// <returns>
'/// The zero-based index of the first occurrence of <paramref name="item">
'/// in the entire <c>SqlParamCollection, if found otherwise, -1.
'///
Public Overridable Function IndexOf(ByVal item As SqlParameter) As Integer
Dim i As Integer
For i = 0 To (m_count - 1) Step 1
If (m_array(i).Equals(item)) Then
Return i
End If
Next
Return -1
End Function
'///
'/// Inserts an element into the <c>SqlParamCollection at the specified index.
'///
'/// <param name="index" />The zero-based index at which <paramref name="item"> should be inserted.
'/// <param name="item" />The <see cref="SqlParameter"> to insert.
'/// <exception cref="ArgumentOutOfRangeException">
'/// <para><paramref name="index"> is less than zero
'/// <para>-or-
'/// <para><paramref name="index"> is equal to or greater than <see cref="SqlParamCollection.Count">.
'///
Public Overridable Sub Insert(ByVal index As Integer, ByVal item As SqlParameter)
ValidateIndex(index, True) '// throws
If (m_count = m_array.Length) Then EnsureCapacity(m_count + 1)
If (index < m_count) Then
Array.Copy(m_array, index, m_array, index + 1, m_count - index)
End If
m_array(index) = item
m_count += 1
m_version += 1
End Sub
'///
'/// Removes the first occurrence of a specific <see cref="SqlParameter"> from the <c>SqlParamCollection.
'///
'/// <param name="item" />The <see cref="SqlParameter"> to remove from the <c>SqlParamCollection.
'/// <exception cref="ArgumentException">
'/// The specified <see cref="SqlParameter"> was not found in the <c>SqlParamCollection.
'///
Public Overridable Sub Remove(ByVal item As SqlParameter)
Dim i As Integer = IndexOf(item)
If (i < 0) Then
Throw New System.ArgumentException("Cannot remove the specified item because it was not found in the specified Collection.")
End If
m_version += 1
RemoveAt(i)
End Sub
'///
'/// Removes the element at the specified index of the <c>SqlParamCollection.
'///
'/// <param name="index" />The zero-based index of the element to remove.
'/// <exception cref="ArgumentOutOfRangeException">
'/// <para><paramref name="index"> is less than zero
'/// <para>-or-
'/// <para><paramref name="index"> is equal to or greater than <see cref="SqlParamCollection.Count">.
'///
Public Overridable Sub RemoveAt(ByVal index As Integer) Implements IList.RemoveAt
ValidateIndex(index) '// throws
m_count -= 1
If (index < m_count) Then
Array.Copy(m_array, index + 1, m_array, index, m_count - index)
End If
'// We can't set the deleted entry equal to null, because it might be a value type.
'// Instead, we'll create an empty single-element array of the right type and copy it
'// over the entry we want to erase.
Dim temp(0) As SqlParameter
temp(0) = New SqlParameter
Array.Copy(temp, 0, m_array, m_count, 1)
m_version += 1
End Sub
'///
'/// Gets a value indicating whether the collection has a fixed size.
'///
'/// <value>true if the collection has a fixed size otherwise, false. The default is false
Public Overridable ReadOnly Property IsFixedSize() As Boolean Implements IList.IsFixedSize
Get
Return False
End Get
End Property
'///
'/// gets a value indicating whether the IList is read-only.
'///
'/// <value>true if the collection is read-only otherwise, false. The default is false
Public Overridable ReadOnly Property IsReadOnly() As Boolean Implements IList.IsReadOnly
Get
Return False
End Get
End Property
#End Region
#Region "Operations (type-safe IEnumerable)"
'///
'/// Returns an enumerator that can iterate through the <c>SqlParamCollection.
'///
'/// <returns>An <see cref="Enumerator"> for the entire <c>SqlParamCollection.
Public Overridable Function GetEnumerator() As ISqlParamCollectionEnumerator
Return New Enumerator(Me)
End Function
#End Region
#Region "Public helpers (just to mimic some nice features of ArrayList)"
'///
'/// Gets or sets the number of elements the <c>SqlParamCollection can contain.
'///
Public Overridable Property Capacity() As Integer
Get
Return m_array.Length
End Get
Set(ByVal Value As Integer)
If (Value < m_count) Then Value = m_count
If Not (Value = m_array.Length) Then
If (Value > 0) Then
' C# implementation
'Dim temp() As SqlParameter = New SqlParameter(Value-1) {}
'Array.Copy(m_array, temp, m_count)
'm_array = temp
' VB implementation
ReDim Preserve m_array(Value)
Else
m_array = New SqlParameter(DEFAULT_CAPACITY) {}
End If
End If
End Set
End Property
'///
'/// Adds the elements of another <c>SqlParamCollection to the current <c>SqlParamCollection.
'///
'/// <param name="x" />The <c>SqlParamCollection whose elements should be added to the end of the current <c>SqlParamCollection.
'/// <returns>The new <see cref="SqlParamCollection.Count"> of the <c>SqlParamCollection.
Public Overridable Function AddRange(ByVal x As SqlParamCollection) As Integer
If (m_count + x.Count >= m_array.Length) Then EnsureCapacity(m_count + x.Count)
Array.Copy(x.m_array, 0, m_array, m_count, x.Count)
m_count += x.Count
m_version += 1
Return m_count
End Function
'///
'/// Adds the elements of a <see cref="SqlParameter"> array to the current <c>SqlParamCollection.
'///
'/// <param name="x" />The <see cref="SqlParameter"> array whose elements should be added to the end of the <c>SqlParamCollection.
'/// <returns>The new <see cref="SqlParamCollection.Count"> of the <c>SqlParamCollection.
Public Overridable Function AddRange(ByVal x() As SqlParameter) As Integer
If (m_count + x.Length >= m_array.Length) Then EnsureCapacity(m_count + x.Length)
Array.Copy(x, 0, m_array, m_count, x.Length)
m_count += x.Length
m_version += 1
Return m_count
End Function
'///
'/// Sets the capacity to the actual number of elements.
'///
Public Overridable Sub TrimToSize()
Me.Capacity = m_count
End Sub
#End Region
#Region "Implementation (helpers)"
'/// <exception cref="ArgumentOutOfRangeException">
'/// <para><paramref name="index"> is less than zero
'/// <para>-or-
'/// <para><paramref name="index"> is equal to or greater than <see cref="SqlParamCollection.Count">.
'///
Private Sub ValidateIndex(ByVal i As Integer)
ValidateIndex(i, False)
End Sub
'/// <exception cref="ArgumentOutOfRangeException">
'/// <para><paramref name="index"> is less than zero
'/// <para>-or-
'/// <para><paramref name="index"> is equal to or greater than <see cref="SqlParamCollection.Count">.
'///
Private Sub ValidateIndex(ByVal i As Integer, ByVal allowEqualEnd As Boolean)
Dim max As Integer
If allowEqualEnd Then
max = m_count
Else
max = m_count - 1
End If
If (i < 0 Or i > max) Then
Throw New System.ArgumentOutOfRangeException("Index was out of range. Must be non-negative and less than the size of the collection.", CType(1, Object), "Specified argument was out of the range of valid values.")
End If
End Sub
'/// <exception cref="ArgumentException">
'/// <para><paramref name="key"> was not found.
'///
Private Function FindItem(ByVal key As String) As Integer
Dim index As Integer
For index = 0 To m_array.Length - 1
If m_array(index).ParameterName = key Then
Return index
End If
Next
Throw New System.ArgumentException("The specified key was not found.")
End Function
Private Sub EnsureCapacity(ByVal min As Integer)
Dim newCapacity As Integer
If m_array.Length = 0 Then
newCapacity = DEFAULT_CAPACITY
Else
newCapacity = m_array.Length * 2
End If
If (newCapacity < min) Then newCapacity = min
Me.Capacity = newCapacity
End Sub
#End Region
#Region "Implementation (ICollection)"
Sub CopyTo(ByVal array As Array, ByVal start As Integer) Implements ICollection.CopyTo
Array.Copy(m_array, 0, array, start, m_count)
End Sub
#End Region
#Region "Implementation (IList)"
' Default removed
Property IList_Item(ByVal i As Integer) As Object Implements IList.Item
Get
Return CType(Me(i), Object)
End Get
Set(ByVal Value As Object)
Me(i) = CType(Value, SqlParameter)
End Set
End Property
Function Add(ByVal x As Object) As Integer Implements IList.Add
Return Me.Add(CType(x, SqlParameter))
End Function
Function Contains(ByVal x As Object) As Boolean Implements IList.Contains
Return Me.Contains(CType(x, SqlParameter))
End Function
Function IndexOf(ByVal x As Object) As Integer Implements IList.IndexOf
Return Me.IndexOf(CType(x, SqlParameter))
End Function
Sub Insert(ByVal pos As Integer, ByVal x As Object) Implements IList.Insert
Me.Insert(pos, CType(x, SqlParameter))
End Sub
Sub Remove(ByVal x As Object) Implements IList.Remove
Me.Remove(CType(x, SqlParameter))
End Sub
'Sub RemoveAt(ByVal pos As Integer) Implements IList.RemoveAt
' Me.RemoveAt(pos)
'End Sub
#End Region
#Region "Implementation (IEnumerable)"
Function IEnumerable_GetEnumerator() As IEnumerator Implements IEnumerable.GetEnumerator
Return CType(Me.GetEnumerator(), IEnumerator)
End Function
#End Region
#Region "Nested enumerator class"
'///
'/// Supports simple iteration over a <see cref="SqlParamCollection">.
'///
Private Class Enumerator
Implements IEnumerator, ISqlParamCollectionEnumerator
#Region "Implementation (data)"
Private m_collection As SqlParamCollection
Private m_index As Integer
Private m_version As Integer
#End Region
#Region "Construction"
'///
'/// Initializes a new instance of the <c>Enumerator class.
'///
'/// <param name="tc" />
Friend Sub New(ByVal tc As SqlParamCollection)
m_collection = tc
m_index = -1
m_version = tc.m_version
End Sub
#End Region
#Region "Operations (type-safe IEnumerator)"
'///
'/// Gets the current element in the collection.
'///
Public ReadOnly Property Current() As SqlParameter Implements ISqlParamCollectionEnumerator.Current
Get
Return m_collection(m_index)
End Get
End Property
'///
'/// Advances the enumerator to the next element in the collection.
'///
'/// <exception cref="InvalidOperationException">
'/// The collection was modified after the enumerator was created.
'///
'/// <returns>
'/// <c>true if the enumerator was successfully advanced to the next element
'/// <c>false if the enumerator has passed the end of the collection.
'///
Public Function MoveNext() As Boolean Implements IEnumerator.MoveNext, ISqlParamCollectionEnumerator.MoveNext
If Not (m_version = m_collection.m_version) Then
Throw New System.InvalidOperationException("Collection was modified enumeration operation may not execute.")
End If
m_index += 1
If m_index < m_collection.Count Then
Return True
Else
Return False
End If
End Function
'///
'/// Sets the enumerator to its initial position, before the first element in the collection.
'///
Public Sub Reset() Implements IEnumerator.Reset, ISqlParamCollectionEnumerator.Reset
m_index = -1
End Sub
#End Region
#Region "Implementation (IEnumerator)"
ReadOnly Property IEnumerator_Current() As Object Implements IEnumerator.Current
Get
Return CType(Me.Current, Object)
End Get
End Property
#End Region
End Class
#End Region
#Region "Nested Syncronized Wrapper class"
Private Class SyncSqlParamCollection
Inherits SqlParamCollection
#Region "Implementation (data)"
Private m_collection As SqlParamCollection
Private m_root As Object
#End Region
#Region "Construction"
Friend Sub New(ByVal list As SqlParamCollection)
m_root = list.SyncRoot
m_collection = list
End Sub
#End Region
#Region "Type-safe ICollection"
Public Overloads Overrides Sub CopyTo(ByVal array() As SqlParameter)
SyncLock Me.m_root
m_collection.CopyTo(array)
End SyncLock
End Sub
Public Overloads Overrides Sub CopyTo(ByVal array() As SqlParameter, ByVal start As Integer)
SyncLock Me.m_root
m_collection.CopyTo(array, start)
End SyncLock
End Sub
Public Overrides ReadOnly Property Count() As Integer
Get
SyncLock Me.m_root
Return m_collection.Count
End SyncLock
End Get
End Property
Public Overrides ReadOnly Property IsSynchronized() As Boolean
Get
Return True
End Get
End Property
Public Overrides ReadOnly Property SyncRoot() As Object
Get
Return Me.m_root
End Get
End Property
#End Region
#Region "Type-safe IList"
Default Public Overloads Overrides Property Item(ByVal i As Integer) As SqlParameter
Get
SyncLock Me.m_root
Return m_collection(i)
End SyncLock
End Get
Set(ByVal Value As SqlParameter)
SyncLock Me.m_root
m_collection(i) = Value
End SyncLock
End Set
End Property
Public Overloads Overrides Function Add(ByVal x As SqlParameter) As Integer
SyncLock Me.m_root
Return m_collection.Add(x)
End SyncLock
End Function
Public Overrides Sub Clear()
SyncLock Me.m_root
m_collection.Clear()
End SyncLock
End Sub
Public Overloads Overrides Function Contains(ByVal x As SqlParameter) As Boolean
SyncLock Me.m_root
Return m_collection.Contains(x)
End SyncLock
End Function
Public Overloads Overrides Function IndexOf(ByVal x As SqlParameter) As Integer
SyncLock Me.m_root
Return m_collection.IndexOf(x)
End SyncLock
End Function
Public Overloads Overrides Sub Insert(ByVal pos As Integer, ByVal x As SqlParameter)
SyncLock Me.m_root
m_collection.Insert(pos, x)
End SyncLock
End Sub
Public Overloads Overrides Sub Remove(ByVal x As SqlParameter)
SyncLock Me.m_root
m_collection.Remove(x)
End SyncLock
End Sub
Public Overrides Sub RemoveAt(ByVal pos As Integer)
SyncLock Me.m_root
m_collection.RemoveAt(pos)
End SyncLock
End Sub
Public Overrides ReadOnly Property IsFixedSize() As Boolean
Get
Return m_collection.IsFixedSize
End Get
End Property
Public Overrides ReadOnly Property IsReadOnly() As Boolean
Get
Return m_collection.IsReadOnly
End Get
End Property
#End Region
#Region "Type-safe IEnumerable"
Public Overrides Function GetEnumerator() As ISqlParamCollectionEnumerator
SyncLock Me.m_root
Return m_collection.GetEnumerator()
End SyncLock
End Function
#End Region
#Region "Public Helpers"
'// (just to mimic some nice features of ArrayList)
Public Overrides Property Capacity() As Integer
Get
SyncLock Me.m_root
Return m_collection.Capacity
End SyncLock
End Get
Set(ByVal Value As Integer)
SyncLock Me.m_root
m_collection.Capacity = Value
End SyncLock
End Set
End Property
Public Overloads Overrides Function AddRange(ByVal x As SqlParamCollection) As Integer
SyncLock Me.m_root
Return m_collection.AddRange(x)
End SyncLock
End Function
Public Overloads Overrides Function AddRange(ByVal x() As SqlParameter) As Integer
SyncLock Me.m_root
Return m_collection.AddRange(x)
End SyncLock
End Function
#End Region
End Class
#End Region
#Region "Nested Read Only Wrapper class"
Private Class ReadOnlySqlParamCollection
Inherits SqlParamCollection
#Region "Implementation (data)"
Private m_collection As SqlParamCollection
#End Region
#Region "Construction"
Friend Sub New(ByVal list As SqlParamCollection)
m_collection = list
End Sub
#End Region
#Region "Type-safe ICollection"
Public Overloads Overrides Sub CopyTo(ByVal array() As SqlParameter)
m_collection.CopyTo(array)
End Sub
Public Overloads Overrides Sub CopyTo(ByVal array() As SqlParameter, ByVal start As Integer)
m_collection.CopyTo(array, start)
End Sub
Public Overrides ReadOnly Property Count() As Integer
Get
Return m_collection.Count
End Get
End Property
Public Overrides ReadOnly Property IsSynchronized() As Boolean
Get
Return m_collection.IsSynchronized
End Get
End Property
Public Overrides ReadOnly Property SyncRoot() As Object
Get
Return Me.m_collection.SyncRoot
End Get
End Property
#End Region
#Region "Type-safe IList"
Default Public Overloads Overrides Property Item(ByVal i As Integer) As SqlParameter
Get
Return m_collection(i)
End Get
Set(ByVal Value As SqlParameter)
Throw New NotSupportedException("This is a Read Only Collection and can not be modified")
End Set
End Property
Public Overloads Overrides Function Add(ByVal x As SqlParameter) As Integer
Throw New NotSupportedException("This is a Read Only Collection and can not be modified")
End Function
Public Overrides Sub Clear()
Throw New NotSupportedException("This is a Read Only Collection and can not be modified")
End Sub
Public Overloads Overrides Function Contains(ByVal x As SqlParameter) As Boolean
Return m_collection.Contains(x)
End Function
Public Overloads Overrides Function IndexOf(ByVal x As SqlParameter) As Integer
Return m_collection.IndexOf(x)
End Function
Public Overloads Overrides Sub Insert(ByVal pos As Integer, ByVal x As SqlParameter)
Throw New NotSupportedException("This is a Read Only Collection and can not be modified")
End Sub
Public Overloads Overrides Sub Remove(ByVal x As SqlParameter)
Throw New NotSupportedException("This is a Read Only Collection and can not be modified")
End Sub
Public Overrides Sub RemoveAt(ByVal pos As Integer)
Throw New NotSupportedException("This is a Read Only Collection and can not be modified")
End Sub
Public Overrides ReadOnly Property IsFixedSize() As Boolean
Get
Return True
End Get
End Property
Public Overrides ReadOnly Property IsReadOnly() As Boolean
Get
Return True
End Get
End Property
#End Region
#Region "Type-safe IEnumerable"
Public Overrides Function GetEnumerator() As ISqlParamCollectionEnumerator
Return m_collection.GetEnumerator()
End Function
#End Region
#Region "Public Helpers"
'// (just to mimic some nice features of ArrayList)
Public Overrides Property Capacity() As Integer
Get
Return m_collection.Capacity
End Get
Set(ByVal Value As Integer)
Throw New NotSupportedException("This is a Read Only Collection and can not be modified")
End Set
End Property
Public Overloads Overrides Function AddRange(ByVal x As SqlParamCollection) As Integer
Throw New NotSupportedException("This is a Read Only Collection and can not be modified")
End Function
Public Overloads Overrides Function AddRange(ByVal x() As SqlParameter) As Integer
Throw New NotSupportedException("This is a Read Only Collection and can not be modified")
End Function
#End Region
End Class
#End Region
End Class
Ravi
|
|
|
|
|
(via Instant C# - let me know how the converted code works for you - your original posted formatting is preserved)
using System;
using System.Data.SqlClient;
using System.Collections;
/////
///// A strongly-typed collection of objects.
/////
internal class SqlParamCollection : ICollection, IList, IEnumerable, ICloneable
{
#region Interfaces
/////
///// Supports type-safe iteration over a .
/////
public interface ISqlParamCollectionEnumerator
{
/////
///// Gets the current element in the collection.
/////
SqlParameter Current {get;}
/////
///// Advances the enumerator to the next element in the collection.
/////
/////
///// The collection was modified after the enumerator was created.
/////
/////
///// true if the enumerator was successfully advanced to the next element
///// false if the enumerator has passed the end of the collection.
/////
bool MoveNext();
/////
///// Sets the enumerator to its initial position, before the first element in the collection.
/////
void Reset();
}
#endregion
private const int DEFAULT_CAPACITY = 15;
#region Implementation (data)
private SqlParameter[] m_array;
private int m_count = 0;
private int m_version = 0;
#endregion
#region Static Wrappers
/////
///// Creates a synchronized (thread-safe) wrapper for a
///// SqlParamCollection instance.
/////
/////
///// An SqlParamCollection wrapper that is synchronized (thread-safe).
/////
public static SqlParamCollection Synchronized(SqlParamCollection list)
{
if (list == null)
{
throw new ArgumentNullException("list");
}
return new SyncSqlParamCollection(list);
}
/////
///// Creates a read-only wrapper for a
///// SqlParamCollection instance.
/////
/////
///// An SqlParamCollection wrapper that is read-only.
/////
public static SqlParamCollection GetReadOnly(SqlParamCollection list)
{
if (list == null)
{
throw new ArgumentNullException("list");
}
return new ReadOnlySqlParamCollection(list);
}
#endregion
#region Construction
/////
///// Initializes a new instance of the SqlParamCollection class
///// that is empty and has the default initial capacity.
/////
public SqlParamCollection()
{
m_array = new SqlParameter[DEFAULT_CAPACITY + 1];
}
/////
///// Initializes a new instance of the SqlParamCollection class
///// that has the specified initial capacity.
/////
/////
///// The number of elements that the new SqlParamCollection is initially capable of storing.
/////
public SqlParamCollection(int capacity)
{
m_array = new SqlParameter[capacity + 1];
}
/////
///// Initializes a new instance of the SqlParamCollection class
///// that contains elements copied from the specified SqlParamCollection.
/////
///// The SqlParamCollection whose elements are copied to the new collection.
public SqlParamCollection(SqlParamCollection c)
{
m_array = new SqlParameter[c.Count + 1];
AddRange(c);
}
/////
///// Initializes a new instance of the SqlParamCollection class
///// that contains elements copied from the specified array.
/////
///// The array whose elements are copied to the new list.
public SqlParamCollection(SqlParameter[] a)
{
m_array = new SqlParameter[a.Length + 1];
AddRange(a);
}
#endregion
#region Operations (type-safe ICollection)
/////
///// Gets the number of elements actually contained in the SqlParamCollection.
/////
public virtual int Count
{
get
{
return m_count;
}
}
/////
///// Copies the entire SqlParamCollection to a one-dimensional
///// array.
/////
///// The one-dimensional array to copy to.
public virtual void CopyTo(SqlParameter[] array)
{
this.CopyTo(array, 0);
}
/////
///// Copies the entire SqlParamCollection to a one-dimensional
///// array, starting at the specified index of the target array.
/////
///// The one-dimensional array to copy to.
///// The zero-based index in at which copying begins.
public virtual void CopyTo(SqlParameter[] array, int start)
{
if (m_count > (array.GetUpperBound(0) + 1 - start))
{
throw new System.ArgumentException("Destination array was not long enough.");
}
System.Array.Copy(m_array, 0, array, start, m_count);
}
/////
///// Gets a value indicating whether access to the collection is synchronized (thread-safe).
/////
///// true if access to the ICollection is synchronized (thread-safe) otherwise, false.
public virtual bool IsSynchronized
{
get
{
return m_array.IsSynchronized;
}
}
/////
///// Gets an object that can be used to synchronize access to the collection.
/////
public virtual object SyncRoot
{
get
{
return m_array.SyncRoot;
}
}
#endregion
#region Operations (type-safe IList)
/////
///// Gets or sets the at the specified index.
/////
///// The zero-based index of the element to get or set.
/////
///// is less than zero
///// -or-
///// is equal to or greater than .
/////
public virtual SqlParameter this[int index]
{
get
{
ValidateIndex(index); //// throws
return m_array[index];
}
set
{
ValidateIndex(index); //// throws
m_version += 1;
m_array[index] = value;
}
}
/////
///// Gets or sets the with the specified key.
/////
///// The name of the element to get or set.
/////
/////
public virtual SqlParameter this[string key]
{
get
{
int index = 0;
index = FindItem(key); //// throws
return m_array[index];
}
set
{
int index = 0;
index = FindItem(key); //// throws
m_version += 1;
m_array[index] = value;
}
}
/////
///// Adds a to the end of the SqlParamCollection.
/////
///// The to be added to the end of the SqlParamCollection.
///// The index at which the value has been added.
public virtual int Add(SqlParameter item)
{
if (m_count == m_array.Length)
{
EnsureCapacity(m_count + 1);
}
m_array[m_count] = item;
m_version += 1;
m_count += 1;
return (m_count - 1);
}
/////
///// Removes all elements from the SqlParamCollection.
/////
public virtual void Clear()
{
m_version += 1;
m_array = new SqlParameter[DEFAULT_CAPACITY + 1];
m_count = 0;
}
/////
///// Creates a shallow copy of the .
/////
public virtual object Clone()
{
SqlParamCollection newColl = new SqlParamCollection(m_count);
Array.Copy(m_array, 0, newColl.m_array, 0, m_count);
newColl.m_count = m_count;
newColl.m_version = m_version;
return newColl;
}
/////
///// Determines whether a given is in the SqlParamCollection.
/////
///// The to check for.
///// true if is found in the SqlParamCollection otherwise, false.
public virtual bool Contains(SqlParameter item)
{
int i = 0;
for (i = 0; i <= (m_count - 1); i++)
{
if (m_array[i].Equals(item))
{
return true;
}
}
return false;
}
/////
///// Returns the zero-based index of the first occurrence of a
///// in the SqlParamCollection.
/////
///// The to locate in the SqlParamCollection.
/////
///// The zero-based index of the first occurrence of
///// in the entire SqlParamCollection, if found otherwise, -1.
/////
public virtual int IndexOf(SqlParameter item)
{
int i = 0;
for (i = 0; i <= (m_count - 1); i++)
{
if (m_array[i].Equals(item))
{
return i;
}
}
return -1;
}
/////
///// Inserts an element into the SqlParamCollection at the specified index.
/////
///// The zero-based index at which should be inserted.
///// The to insert.
/////
///// is less than zero
///// -or-
///// is equal to or greater than .
/////
public virtual void Insert(int index, SqlParameter item)
{
ValidateIndex(index, true); //// throws
if (m_count == m_array.Length)
{
EnsureCapacity(m_count + 1);
}
if (index < m_count)
{
Array.Copy(m_array, index, m_array, index + 1, m_count - index);
}
m_array[index] = item;
m_count += 1;
m_version += 1;
}
/////
///// Removes the first occurrence of a specific from the SqlParamCollection.
/////
///// The to remove from the SqlParamCollection.
/////
///// The specified was not found in the SqlParamCollection.
/////
public virtual void Remove(SqlParameter item)
{
int i = IndexOf(item);
if (i < 0)
{
throw new System.ArgumentException("Cannot remove the specified item because it was not found in the specified Collection.");
}
m_version += 1;
RemoveAt(i);
}
/////
///// Removes the element at the specified index of the SqlParamCollection.
/////
///// The zero-based index of the element to remove.
/////
///// is less than zero
///// -or-
///// is equal to or greater than .
/////
public virtual void RemoveAt(int index)
{
ValidateIndex(index); //// throws
m_count -= 1;
if (index < m_count)
{
Array.Copy(m_array, index + 1, m_array, index, m_count - index);
}
//// We can't set the deleted entry equal to null, because it might be a value type.
//// Instead, we'll create an empty single-element array of the right type and copy it
//// over the entry we want to erase.
SqlParameter[] temp = new SqlParameter[1];
temp[0] = new SqlParameter();
Array.Copy(temp, 0, m_array, m_count, 1);
m_version += 1;
}
/////
///// Gets a value indicating whether the collection has a fixed size.
/////
///// true if the collection has a fixed size otherwise, false. The default is false
public virtual bool IsFixedSize
{
get
{
return false;
}
}
/////
///// gets a value indicating whether the IList is read-only.
/////
///// true if the collection is read-only otherwise, false. The default is false
public virtual bool IsReadOnly
{
get
{
return false;
}
}
#endregion
#region Operations (type-safe IEnumerable)
/////
///// Returns an enumerator that can iterate through the SqlParamCollection.
/////
///// An for the entire SqlParamCollection.
public virtual ISqlParamCollectionEnumerator GetEnumerator()
{
return new Enumerator(this);
}
#endregion
#region Public helpers (just to mimic some nice features of ArrayList)
/////
///// Gets or sets the number of elements the SqlParamCollection can contain.
/////
public virtual int Capacity
{
get
{
return m_array.Length;
}
set
{
if (value < m_count)
{
value = m_count;
}
if (! (value == m_array.Length))
{
if (value > 0)
{
// C# implementation
//Dim temp() As SqlParameter = New SqlParameter(Value-1) {}
//Array.Copy(m_array, temp, m_count)
//m_array = temp
// VB implementation
Array.Resize(ref m_array, value + 1);
}
else
{
m_array = new SqlParameter[DEFAULT_CAPACITY + 1];
}
}
}
}
/////
///// Adds the elements of another SqlParamCollection to the current SqlParamCollection.
/////
///// The SqlParamCollection whose elements should be added to the end of the current SqlParamCollection.
///// The new of the SqlParamCollection.
public virtual int AddRange(SqlParamCollection x)
{
if (m_count + x.Count >= m_array.Length)
{
EnsureCapacity(m_count + x.Count);
}
Array.Copy(x.m_array, 0, m_array, m_count, x.Count);
m_count += x.Count;
m_version += 1;
return m_count;
}
/////
///// Adds the elements of a array to the current SqlParamCollection.
/////
///// The array whose elements should be added to the end of the SqlParamCollection.
///// The new of the SqlParamCollection.
public virtual int AddRange(SqlParameter[] x)
{
if (m_count + x.Length >= m_array.Length)
{
EnsureCapacity(m_count + x.Length);
}
Array.Copy(x, 0, m_array, m_count, x.Length);
m_count += x.Length;
m_version += 1;
return m_count;
}
/////
///// Sets the capacity to the actual number of elements.
/////
public virtual void TrimToSize()
{
this.Capacity = m_count;
}
#endregion
#region Implementation (helpers)
/////
///// is less than zero
///// -or-
///// is equal to or greater than .
/////
private void ValidateIndex(int i)
{
ValidateIndex(i, false);
}
/////
///// is less than zero
///// -or-
///// is equal to or greater than .
/////
private void ValidateIndex(int i, bool allowEqualEnd)
{
int max = 0;
if (allowEqualEnd)
{
max = m_count;
}
else
{
max = m_count - 1;
}
if (i < 0 | i > max)
{
throw new System.ArgumentOutOfRangeException("Index was out of range. Must be non-negative and less than the size of the collection.", (object)1, "Specified argument was out of the range of valid values.");
}
}
/////
///// was not found.
/////
private int FindItem(string key)
{
int index = 0;
for (index = 0; index < m_array.Length; index++)
{
if (m_array[index].ParameterName == key)
{
return index;
}
}
throw new System.ArgumentException("The specified key was not found.");
}
private void EnsureCapacity(int min)
{
int newCapacity = 0;
if (m_array.Length == 0)
{
newCapacity = DEFAULT_CAPACITY;
}
else
{
newCapacity = m_array.Length * 2;
}
if (newCapacity < min)
{
newCapacity = min;
}
this.Capacity = newCapacity;
}
#endregion
#region Implementation (ICollection)
public void CopyTo(Array array, int start)
{
array.Copy(m_array, 0, array, start, m_count);
}
#endregion
#region Implementation (IList)
// Default removed
//ORIGINAL LINE: Property IList_Item(ByVal i As Integer) As Object Implements IList.Item
//INSTANT C# NOTE: C# does not support parameterized properties - the following property has been divided into two methods:
public object GetIList_Item(int i)
{
return (object)(this[i]);
}
public void SetIList_Item(int i, object Value)
{
this[i] = (SqlParameter)Value;
}
public int Add(object x)
{
return this.Add((SqlParameter)x);
}
public bool Contains(object x)
{
return this.Contains((SqlParameter)x);
}
public int IndexOf(object x)
{
return this.IndexOf((SqlParameter)x);
}
public void Insert(int pos, object x)
{
this.Insert(pos, (SqlParameter)x);
}
public void Remove(object x)
{
this.Remove((SqlParameter)x);
}
//Sub RemoveAt(ByVal pos As Integer) Implements IList.RemoveAt
// Me.RemoveAt(pos)
//End Sub
#endregion
#region Implementation (IEnumerable)
IEnumerator IEnumerable.GetEnumerator()
{
return IEnumerable_GetEnumerator();
}
public IEnumerator IEnumerable_GetEnumerator()
{
return (IEnumerator)(this.GetEnumerator());
}
#endregion
#region Nested enumerator class
/////
///// Supports simple iteration over a .
/////
private class Enumerator : IEnumerator, ISqlParamCollectionEnumerator
{
#region Implementation (data)
private SqlParamCollection m_collection;
private int m_index;
private int m_version;
#endregion
#region Construction
/////
///// Initializes a new instance of the Enumerator class.
/////
/////
internal Enumerator(SqlParamCollection tc)
{
m_collection = tc;
m_index = -1;
m_version = tc.m_version;
}
#endregion
#region Operations (type-safe IEnumerator)
/////
///// Gets the current element in the collection.
/////
public SqlParameter Current
{
get
{
return m_collection[m_index];
}
}
/////
///// Advances the enumerator to the next element in the collection.
/////
/////
///// The collection was modified after the enumerator was created.
/////
/////
///// true if the enumerator was successfully advanced to the next element
///// false if the enumerator has passed the end of the collection.
/////
public bool MoveNext()
{
if (! (m_version == m_collection.m_version))
{
throw new System.InvalidOperationException("Collection was modified enumeration operation may not execute.");
}
m_index += 1;
if (m_index < m_collection.Count)
{
return true;
}
else
{
return false;
}
}
/////
///// Sets the enumerator to its initial position, before the first element in the collection.
/////
public void Reset()
{
m_index = -1;
}
#endregion
#region Implementation (IEnumerator)
object IEnumerator.Current
{
get
{
return IEnumerator_Current;
}
}
public object IEnumerator_Current
{
get
{
return (object)this.Current;
}
}
#endregion
}
#endregion
#region Nested Syncronized Wrapper class
private class SyncSqlParamCollection : SqlParamCollection
{
#region Implementation (data)
private SqlParamCollection m_collection;
private object m_root;
#endregion
#region Construction
internal SyncSqlParamCollection(SqlParamCollection list)
{
m_root = list.SyncRoot;
m_collection = list;
}
#endregion
#region Type-safe ICollection
public override void CopyTo(SqlParameter[] array)
{
lock(this.m_root)
{
m_collection.CopyTo(array);
}
}
public override void CopyTo(SqlParameter[] array, int start)
{
lock(this.m_root)
{
m_collection.CopyTo(array, start);
}
}
public override int Count
{
get
{
lock(this.m_root)
{
return m_collection.Count;
}
}
}
public override bool IsSynchronized
{
get
{
return true;
}
}
public override object SyncRoot
{
get
{
return this.m_root;
}
}
#endregion
#region Type-safe IList
public override SqlParameter this[int i]
{
get
{
lock(this.m_root)
{
return m_collection[i];
}
}
set
{
lock(this.m_root)
{
m_collection[i] = value;
}
}
}
public override int Add(SqlParameter x)
{
lock(this.m_root)
{
return m_collection.Add(x);
}
}
public override void Clear()
{
lock(this.m_root)
{
m_collection.Clear();
}
}
public override bool Contains(SqlParameter x)
{
lock(this.m_root)
{
return m_collection.Contains(x);
}
}
public override int IndexOf(SqlParameter x)
{
lock(this.m_root)
{
return m_collection.IndexOf(x);
}
}
public override void Insert(int pos, SqlParameter x)
{
lock(this.m_root)
{
m_collection.Insert(pos, x);
}
}
public override void Remove(SqlParameter x)
{
lock(this.m_root)
{
m_collection.Remove(x);
}
}
public override void RemoveAt(int pos)
{
lock(this.m_root)
{
m_collection.RemoveAt(pos);
}
}
public override bool IsFixedSize
{
get
{
return m_collection.IsFixedSize;
}
}
public override bool IsReadOnly
{
get
{
return m_collection.IsReadOnly;
}
}
#endregion
#region Type-safe IEnumerable
public override ISqlParamCollectionEnumerator GetEnumerator()
{
lock(this.m_root)
{
return m_collection.GetEnumerator();
}
}
#endregion
#region Public Helpers
//// (just to mimic some nice features of ArrayList)
public override int Capacity
{
get
{
lock(this.m_root)
{
return m_collection.Capacity;
}
}
set
{
lock(this.m_root)
{
m_collection.Capacity = value;
}
}
}
public override int AddRange(SqlParamCollection x)
{
lock(this.m_root)
{
return m_collection.AddRange(x);
}
}
public override int AddRange(SqlParameter[] x)
{
lock(this.m_root)
{
return m_collection.AddRange(x);
}
}
#endregion
}
#endregion
#region Nested Read Only Wrapper class
private class ReadOnlySqlParamCollection : SqlParamCollection
{
#region Implementation (data)
private SqlParamCollection m_collection;
#endregion
#region Construction
internal ReadOnlySqlParamCollection(SqlParamCollection list)
{
m_collection = list;
}
#endregion
#region Type-safe ICollection
public override void CopyTo(SqlParameter[] array)
{
m_collection.CopyTo(array);
}
public override void CopyTo(SqlParameter[] array, int start)
{
m_collection.CopyTo(array, start);
}
public override int Count
{
get
{
return m_collection.Count;
}
}
public override bool IsSynchronized
{
get
{
return m_collection.IsSynchronized;
}
}
public override object SyncRoot
{
get
{
return this.m_collection.SyncRoot;
}
}
#endregion
#region Type-safe IList
public override SqlParameter this[int i]
{
get
{
return m_collection[i];
}
set
{
throw new NotSupportedException("This is a Read Only Collection and can not be modified");
}
}
public override int Add(SqlParameter x)
{
throw new NotSupportedException("This is a Read Only Collection and can not be modified");
}
public override void Clear()
{
throw new NotSupportedException("This is a Read Only Collection and can not be modified");
}
public override bool Contains(SqlParameter x)
{
return m_collection.Contains(x);
}
public override int IndexOf(SqlParameter x)
{
return m_collection.IndexOf(x);
}
public override void Insert(int pos, SqlParameter x)
{
throw new NotSupportedException("This is a Read Only Collection and can not be modified");
}
public override void Remove(SqlParameter x)
{
throw new NotSupportedException("This is a Read Only Collection and can not be modified");
}
public override void RemoveAt(int pos)
{
throw new NotSupportedException("This is a Read Only Collection and can not be modified");
}
public override bool IsFixedSize
{
get
{
return true;
}
}
public override bool IsReadOnly
{
get
{
return true;
}
}
#endregion
#region Type-safe IEnumerable
public override ISqlParamCollectionEnumerator GetEnumerator()
{
return m_collection.GetEnumerator();
}
#endregion
#region Public Helpers
//// (just to mimic some nice features of ArrayList)
public override int Capacity
{
get
{
return m_collection.Capacity;
}
set
{
throw new NotSupportedException("This is a Read Only Collection and can not be modified");
}
}
public override int AddRange(SqlParamCollection x)
{
throw new NotSupportedException("This is a Read Only Collection and can not be modified");
}
public override int AddRange(SqlParameter[] x)
{
throw new NotSupportedException("This is a Read Only Collection and can not be modified");
}
#endregion
}
#endregion
}
David Anton
www.tangiblesoftwaresolutions.com
Instant C#: VB to C# converter
Instant VB: C# to VB converter
Instant C++: C# to C++ converter, VB to C++ converter
Instant Python: C# to Python converter, VB to Python converter
|
|
|
|
|
Hello,
I have an ASP.NET page and in its runtime code I am trying to get an
user profile, change it and save it.
It works if I use Profile, which is the profile for the current
authenticated user. But I want to change the profile of another user.
Anyway, I am using:
1 Dim pcProfile As ProfileCommon =
CType(ProfileCommon.Create(Username), ProfileCommon)
2
3 ' Update personal
4 With pcProfile.Personal
5 .Blog = tbBlog.Text
6 .Homepage = tbHomepage.Text
7 .Name = tbName.Text
8 End With
9
10 pcProfile.Save()
This is not working.
What am I doing wrong?
Thanks,
Miguel
|
|
|
|
|
I have a website written in vb.net. The SessionID keep changing everytime i refresh the page
Response.write Session.sessionID
Has anyone got that problem before?
Please help, I am so stress now.
Regards
Nick
P.S I create the another website on the server just to printout the SessionID and it works just fine ( no new value when the page was refresh)
|
|
|
|
|
Hello Nick,
The SessionID keeps changing when no data is assigned to the Session Object. When you assign a value to the Session, the SessionID will not change.
|
|
|
|
|
Hi Can you please tell me about the free / open source blogs available in ASP.Net 2.0
Any database will do.
Please provide links if possible.
Thanks ..
Deepak Surana
|
|
|
|
|
I have a business related intranet site written entirely in asp, note the conspicuous absence of the letter x. I, when I say I in this context I mean our security team, have decided it would be a good idea to handle security through active directory. The aspx code I, I meaning me, have written pulls back a domain and username quite nicely. I would like to do a little database authentication, not a problem, and based on the outcome set a few session variables defining access rights and redirect the user to the old asp pages I have in place.
I have tried both the response.redirect("somepage.asp") and the server.transfer("someotherpage.asp") and they both blow. Can I not get from aspx back into the asp world?
Any help would be appreciated.
|
|
|
|
|
Is the ASP code and .NET code are used in a same project, I mean same Solution??
|
|
|
|
|