Collection Read Only ERROR, help

R

ronaldlee

Hi, I am using ADO code and
I got a collection read only error. I have setted the LockType to
Optimistic and CursorType to Dynamic, but it still have the same
error, anyone have any ideas? I am appreciate for your help.

Ron


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.

Source Error:

Line 14: objRS.Open("INSERT INTO Customers (Customer_UserName,
Customer_Password, Customer_Name, Customer_Email,
Customer_Address_Line1, Customer_Address_Line2,
Customer_Address_PostCode, Customer_Address_County,
Customer_Telephone, Customer_Fax) VALUES ('" &
SQL_safe(Request.Form.Item("username")) & "','" &
SQL_safe(Request.Form.Item("user_password")) & "','" &
SQL_safe(Request.Form.Item("realname")) & "', '" &
SQL_safe(Request.Form.Item("email")) & "', '" &
SQL_safe(Request.Form.Item("billing_house")) & "', '" &
SQL_safe(Request.Form.Item("billing_street")) & "', '" &
SQL_safe(Request.Form.Item("billing_area")) & "', '" &
SQL_safe(Request.Form.Item("billing_town")) & "', '" &
SQL_safe(Request.Form.Item("billing_county")) & "', '" &
SQL_safe(Request.Form.Item("billing_postcode")) & "', '" &
SQL_safe(Request.Form.Item("telephone")) & "', '" &
SQL_safe(Request.Form.Item("fax")) & "')", objConn)


below is my function


<script language="VB" runat="Server">
Dim objConn As ADODB.Connection
Dim objRS As ADODB.Recordset
Dim dbDNS As String
Dim name As Object
Dim value As Object
'Set ADODB.LockTypeEnum.adLockOptimistic
'Set ADODB.CursorTypeEnum.adOpenDynamic
Const adOpenDynamic = 2
Const adLockOptimistic = 3



Function openDB() As Object
Const adOpenDynamic = 2
Const adLockOptimistic = 3



objConn = New ADODB.Connection
objConn.Open("COMP224_Assignment_Database")


objRS = New ADODB.Recordset
objRS.LockType = ADODB.LockTypeEnum.adLockOptimistic
objRS.CursorType = ADODB.CursorTypeEnum.adOpenDynamic


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()
objConn = Nothing
End Function

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

ronaldlee

help please, I need to sort this out ASAP.
I have setted the permission of my folder and the database file to
read, write, modify. So it should not be the problem of the
permission

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

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top