473,652 Members | 3,059 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Error, Collection is read only

I have this error in Line 89.

Collection is read-only.
Description: An unhandled exception occurred during the execution of
the current web request. Please review the stack trace for more
information about the error and where it originated in the code.

Exception Details: System.NotSuppo rtedException: Collection is
read-only.

Source Error:
Line 87: Else
Line 88:
Line 89: objRS.Open("UPD ATE Customers SET Customer_Name = '" &
SQL_safe(Reques t.Form.Item("re alname")) & "', customer_Email = '"
& SQL_safe(Reques t.Form.Item("em ail")) & "',
Customer_Addres s_Line1 = '" &
SQL_safe(Reques t.Form.Item("bi lling_house")) & "',
Customer_Addres s_Line2 = '" &
SQL_safe(Reques t.Form.Item("bi lling_street")) & "',
Customer_Addres s_Line3 = '" &
SQL_safe(Reques t.Form.Item("bi lling_area")) & "',
Customer_Addres s_Line4 = '" &
SQL_safe(Reques t.Form.Item("bi lling_town")) & "',
Customer_Addres s_Line5 = '" &
SQL_safe(Reques t.Form.Item("bi lling_county")) & "',
Customer_Addres s_Line6 = '" &
SQL_safe(Reques t.Form.Item("bi lling_postcode" )) & "',
Customer_Delive ry_Address_Line 1 = '" &
SQL_safe(Reques t.Form.Item("de livery_house")) & "',
Customer_Delive ry_Address_Line 2 = '" &
SQL_safe(Reques t.Form.Item("de livery_street") ) & "',
Customer_Delive ry_Address_Line 3 = '" &
SQL_safe(Reques t.Form.Item("de livery_area")) & "',
Customer_Delive ry_Address_Line 4 = '" &
SQL_safe(Reques t.Form.Item("de livery_town")) & "',
Customer_Delive ry_Address_Line 5 = '" &
SQL_safe(Reques t.Form.Item("de livery_county") ) & "',
Customer_Delive ry_Address_Line 6 = '" &
SQL_safe(Reques t.Form.Item("de livery_postcode ")) & "',
Customer_Teleph one = '" &
SQL_safe(Reques t.Form.Item("te lephone")) & "', Customer_Fax = '"
& SQL_safe(Reques t.Form.Item("fa x")) & "' WHERE CustomerID =
" & Session("Custom erID"), objConn)

Stack Trace:
[NotSupportedExc eption: Collection is read-only.]
System.Collecti ons.Specialized .NameValueColle ction.Set(Strin g name,
String value) +2029663
System.Collecti ons.Specialized .NameValueColle ction.set_Item( String
name, String value) +10
ASP.details_asp x.__Render__con trol1(HtmlTextW riter __w, Control
parameterContai ner) in C:\MySite\detai ls.aspx:89
System.Web.UI.C ontrol.RenderCh ildren(HtmlText Writer writer)
+3153695
System.Web.UI.P age.Render(Html TextWriter writer) +25
System.Web.UI.C ontrol.RenderCo ntrolInternal(H tmlTextWriter writer,
ControlAdapter adapter) +23
System.Web.UI.C ontrol.RenderCo ntrol(HtmlTextW riter writer,
ControlAdapter adapter) +139
System.Web.UI.C ontrol.RenderCo ntrol(HtmlTextW riter writer) +24
System.Web.UI.P age.ProcessRequ estMain(Boolean
includeStagesBe foreAsyncPoint, Boolean includeStagesAf terAsyncPoint)
+5916

anyone know why it is read only?

*-----------------------*
Posted at:
www.GroupSrv.com
*-----------------------*
Nov 19 '05 #1
17 15538
Ronald,
I can't see the specific error in the code you've provided. I can tell you
that some collections are read-only, such as Request.Form. This means that
you can store a value into them. For example, you couldn't do this:

Request.Form("f irstName") = "someValue"

you can only read from them:

dim firstName as string = Request.Form("f irstName")

The error indicates that you are trying to store a value into a read-only
collection. But, looking at the line you provided (not a very nice line by
the way), i can't see the specific instance of this.

Karl

--
MY ASP.Net tutorials
http://www.openmymind.net/
"ronaldlee" <le***********@ yahoo-dot-com.no-spam.invalid> wrote in message
news:41******** **@Usenet.com.. .
I have this error in Line 89.

Collection is read-only.
Description: An unhandled exception occurred during the execution of
the current web request. Please review the stack trace for more
information about the error and where it originated in the code.

Exception Details: System.NotSuppo rtedException: Collection is
read-only.

Source Error:
Line 87: Else
Line 88:
Line 89: objRS.Open("UPD ATE Customers SET Customer_Name = '" &
SQL_safe(Reques t.Form.Item("re alname")) & "', customer_Email = '"
& SQL_safe(Reques t.Form.Item("em ail")) & "',
Customer_Addres s_Line1 = '" &
SQL_safe(Reques t.Form.Item("bi lling_house")) & "',
Customer_Addres s_Line2 = '" &
SQL_safe(Reques t.Form.Item("bi lling_street")) & "',
Customer_Addres s_Line3 = '" &
SQL_safe(Reques t.Form.Item("bi lling_area")) & "',
Customer_Addres s_Line4 = '" &
SQL_safe(Reques t.Form.Item("bi lling_town")) & "',
Customer_Addres s_Line5 = '" &
SQL_safe(Reques t.Form.Item("bi lling_county")) & "',
Customer_Addres s_Line6 = '" &
SQL_safe(Reques t.Form.Item("bi lling_postcode" )) & "',
Customer_Delive ry_Address_Line 1 = '" &
SQL_safe(Reques t.Form.Item("de livery_house")) & "',
Customer_Delive ry_Address_Line 2 = '" &
SQL_safe(Reques t.Form.Item("de livery_street") ) & "',
Customer_Delive ry_Address_Line 3 = '" &
SQL_safe(Reques t.Form.Item("de livery_area")) & "',
Customer_Delive ry_Address_Line 4 = '" &
SQL_safe(Reques t.Form.Item("de livery_town")) & "',
Customer_Delive ry_Address_Line 5 = '" &
SQL_safe(Reques t.Form.Item("de livery_county") ) & "',
Customer_Delive ry_Address_Line 6 = '" &
SQL_safe(Reques t.Form.Item("de livery_postcode ")) & "',
Customer_Teleph one = '" &
SQL_safe(Reques t.Form.Item("te lephone")) & "', Customer_Fax = '"
& SQL_safe(Reques t.Form.Item("fa x")) & "' WHERE CustomerID =
" & Session("Custom erID"), objConn)

Stack Trace:
[NotSupportedExc eption: Collection is read-only.]
System.Collecti ons.Specialized .NameValueColle ction.Set(Strin g name,
String value) +2029663
System.Collecti ons.Specialized .NameValueColle ction.set_Item( String
name, String value) +10
ASP.details_asp x.__Render__con trol1(HtmlTextW riter __w, Control
parameterContai ner) in C:\MySite\detai ls.aspx:89
System.Web.UI.C ontrol.RenderCh ildren(HtmlText Writer writer)
+3153695
System.Web.UI.P age.Render(Html TextWriter writer) +25
System.Web.UI.C ontrol.RenderCo ntrolInternal(H tmlTextWriter writer,
ControlAdapter adapter) +23
System.Web.UI.C ontrol.RenderCo ntrol(HtmlTextW riter writer,
ControlAdapter adapter) +139
System.Web.UI.C ontrol.RenderCo ntrol(HtmlTextW riter writer) +24
System.Web.UI.P age.ProcessRequ estMain(Boolean
includeStagesBe foreAsyncPoint, Boolean includeStagesAf terAsyncPoint)
+5916

anyone know why it is read only?

*-----------------------*
Posted at:
www.GroupSrv.com
*-----------------------*

Nov 19 '05 #2
Do you mind if I send you the whole application so that you can help
me to have a look?

*-----------------------*
Posted at:
www.GroupSrv.com
*-----------------------*
Nov 19 '05 #3
yeah, so I do not know what's wrong with my code

*-----------------------*
Posted at:
www.GroupSrv.com
*-----------------------*
Nov 19 '05 #4
Brad answered your 2nd post ...I think he's onto something...

Karl

--
MY ASP.Net tutorials
http://www.openmymind.net/
"ronaldlee" <le***********@ yahoo-dot-com.no-spam.invalid> wrote in message
news:41******** @Usenet.com...
Do you mind if I send you the whole application so that you can help
me to have a look?

*-----------------------*
Posted at:
www.GroupSrv.com
*-----------------------*

Nov 19 '05 #5
so how can i solve it?
do you mind to leave your email so that i can contact you

*-----------------------*
Posted at:
www.GroupSrv.com
*-----------------------*
Nov 19 '05 #6
here is my code
<script language="VB" runat="Server">
Dim objConn As ADODB.Connectio n
Dim objRS As ADODB.Recordset
Dim dbDNS As String
Dim name As Object
Dim value As Object
Function openDB() As Object
objConn = New ADODB.Connectio n
objConn.Open("d bfile")

objRS = New ADODB.Recordset
End Function
Function closeDB() As Object
' If the RecordSet has a state of 1 (open) close it
If objRS.state = 1 Then
objRS.Close()
End If

objConn.Close()

'UPGRADE_NOTE: Object objConn may not be destroyed until it is
garbage collected. Copy this link in your browser for more:
'http://msdn.microsoft. com/library/en-us/vbcon/html/vbup1029.asp'
objConn = Nothing
End Function
' Generates the county listing
Function generate_county _list(ByRef name As String, ByRef value As
String, ByRef isDelivery As Byte) As String
' ASP doesn't support associate arrays like Perl and PHP, so need to
use a more messy method
' Created by Stephen Ball

Dim South_West(5) As String
Dim North_West(5) As String
Dim East_Midlands(5 ) As String
Dim West_Midlands(6 ) As String
Dim South_Central(6 ) As String
Dim South_East(6) As String
Dim East_Anglia(6) As String
Dim North_East(5) As String
Dim county As String
Dim data As String

East_Anglia(0) = "Bedfordshi re"
East_Anglia(1) = "Cambridgeshire "
East_Anglia(2) = "Essex"
East_Anglia(3) = "Hertfordsh ire"
East_Anglia(4) = "Norfolk"
East_Anglia(5) = "Suffolk"

East_Midlands(0 ) = "Derbeyshir e"
East_Midlands(1 ) = "Leicestershire "
East_Midlands(2 ) = "Lincolnshi re"
East_Midlands(3 ) = "Northamptonshi re"
East_Midlands(4 ) = "Nottinghamshir e"

North_East(0) = "Cleveland"
North_East(1) = "Durham"
North_East(2) = "Northumberland "
North_East(3) = "Tyne and Wear"
North_East(4) = "Yorkshire"

West_Midlands(0 ) = "Herefordsh ire"
West_Midlands(1 ) = "Shopshire"
West_Midlands(2 ) = "Staffordsh ire"
West_Midlands(3 ) = "Warickshir e"
West_Midlands(4 ) = "West Midlands"
West_Midlands(5 ) = "Worcestershire "

North_West(0) = "Cheshire"
North_West(1) = "Cumbria"
North_West(2) = "Greater Manchester"
North_West(3) = "Lancashire "
North_West(4) = "Merseyside "

South_Central(0 ) = "Berkshire"
South_Central(1 ) = "Dorset"
South_Central(2 ) = "Hampshire"
South_Central(3 ) = "Isle of White"
South_Central(4 ) = "Oxfordshir e"
South_Central(5 ) = "West Sussex"

South_East(0) = "Buckinghamshir e"
South_East(1) = "East Sussex"
South_East(2) = "Greater London"
South_East(3) = "Kent"
South_East(4) = "Middlesex"
South_East(5) = "Surrey"

South_West(0) = "Cornwall"
South_West(1) = "Devon"
South_West(2) = "Gloucestershir e"
South_West(3) = "Somerset"
South_West(4) = "Wiltshire"

If isDelivery = 1 Then
data = "<select name=""" & name & """
onchange=""unch eck_billing();" ">"
Else
data = "<select name=""" & name & """>"
End If

data = data & "<option value="""">Sele ct a
county:</option>"

' Generate the East Anglia List
data = data & "<optgroup label=""East Anglia"">"
For Each county In East_Anglia
data = data & create_list(cou nty, value)
Next county

' Generate the East Midlands List
data = data & "<optgroup label=""East Midlands"">"
For Each county In East_Midlands
data = data & create_list(cou nty, value)
Next county

' Generate the North East List
data = data & "<optgroup label=""North East"">"
For Each county In North_East
data = data & create_list(cou nty, value)
Next county

' Generate the West Midlands List
data = data & "<optgroup label=""West Midlands"">"
For Each county In West_Midlands
data = data & create_list(cou nty, value)
Next county

' Generate the North West List
data = data & "<optgroup label=""North West"">"
For Each county In North_West
data = data & create_list(cou nty, value)
Next county

' Generate the South Central List
data = data & "<optgroup label=""South Central"">"
For Each county In South_Central
data = data & create_list(cou nty, value)
Next county

' Generate the South East List
data = data & "<optgroup label=""South East"">"
For Each county In South_East
data = data & create_list(cou nty, value)
Next county

' Generate the South West List
data = data & "<optgroup label=""South West"">"
For Each county In South_West
data = data & create_list(cou nty, value)
Next county

data = data & "</select>"
generate_county _list = data

End Function
' Generates the option value
Function create_list(ByR ef county As String, ByRef current As String)
As String
Dim data As String

If county <> "" Then
If county = current Then
data = data & "<option value=""" & county & """
selected=""sele cted"">" & county & "</option>"
Else
data = data & "<option value=""" & county & """>"
& county & "</option>"
End If
End If

create_list = data
End Function
' A function to make data SQL safe, replace ' with ''
Function SQL_safe(ByRef data As String) As String
data = Replace(data, "'", "''")

SQL_safe = data
End Function

</script>
<%

dbDNS = "COMP224_Assign ment_Database"
%>

hope this helps

*-----------------------*
Posted at:
www.GroupSrv.com
*-----------------------*
Nov 19 '05 #7
so how can i solve this...
i really want to solve this asap..

*-----------------------*
Posted at:
www.GroupSrv.com
*-----------------------*
Nov 19 '05 #8
sorry, I am a beginner, can you give me an example of how to do it?
thanks

*-----------------------*
Posted at:
www.GroupSrv.com
*-----------------------*
Nov 19 '05 #9
sorry, I am a beginner, can you give me an example of how to do it?
thanks

*-----------------------*
Posted at:
www.GroupSrv.com
*-----------------------*
Nov 19 '05 #10

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
5025
by: Wayno | last post by:
My php logs are coming up empty. I have done all I can think of, and all that made sense to me. Can someone take a look at my php.ini please and tell me what you think may be the problem. I double-checked the path to my error log. It is in /var/www/logs/php_error_log Thanks. :) -Wayne Stevenson
6
4739
by: Peter Frost | last post by:
Please help I don't know if this is possible but what I would really like to do is to use On Error Goto to capture the code that is being executed when an error occurs. Any help would be much appreciated. Thanks in advance
16
7214
by: TD | last post by:
This is the code under a command button - Dim ctl As Control For Each ctl In Me.Controls If ctl.BackColor <> RGB(255, 255, 255) Then ctl.BackColor = RGB(255, 255, 255) End If Next ctl
7
7314
by: Philip Wagenaar | last post by:
I use a class to manage tiff's (written by someone else) to splitt multipage tiffs. However, when I run it, it fails, for other people it seems work ok. The method in the class is :public ArrayList SplitTiffImage(string outPutDirectory,EncoderValue format) { string fileStartString=outPutDirectory+"\\"+GetFileNameStartString(_ImageFileName); ArrayList splitedFileNames=new ArrayList(); try
0
1461
by: ronaldlee | last post by:
I got a collection read only error, below is the error message. Collection is read-only. Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. Exception Details: System.NotSupportedException: Collection is read-only.
28
9122
by: Michael Primeaux | last post by:
What is the recommended pattern for implementing a synchronized (thread-safe) class that inherits from Collection<T>? For example, I want to implement a SyncRoot property . I do see where I can override (protected) the methods InsertItem, RemoveItem, ClearItems, and SetItem. However, I do not see an override for GetItem. Kindest regards, Michael
669
25855
by: Xah Lee | last post by:
in March, i posted a essay “What is Expressiveness in a Computer Language”, archived at: http://xahlee.org/perl-python/what_is_expresiveness.html I was informed then that there is a academic paper written on this subject. On the Expressive Power of Programming Languages, by Matthias Felleisen, 1990. http://www.ccs.neu.edu/home/cobbe/pl-seminar-jr/notes/2003-sep-26/expressive-slides.pdf
3
5088
by: jacob navia | last post by:
Abstract: Continuing the discussion about abstract data types, in this discussion group, a string collection data type is presented, patterned after the collection in C# and similar languages (Java). It stores character strings, and resizes itself to accommodate new strings when needed. Interface: ----------
0
3482
by: shahiz | last post by:
This the error i get when i try to run my program Error: Unable to realize com.sun.media.amovie.AMController@18b81e3 Basically i have a mediapanel class that initialize and play the media as datasource import java.awt.BorderLayout; import java.awt.Component; import java.io.*; import java.net.URL; import javax.media.*;
0
8367
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, well explore What is ONU, What Is Router, ONU & Routers main usage, and What is the difference between ONU and Router. Lets take a closer look ! Part I. Meaning of...
0
8279
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
1
8467
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8589
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
6160
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupr who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5619
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4145
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
2703
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1914
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.