Wierd Error with code or database

Results 1 to 2 of 2

Thread: Wierd Error with code or database

  1. #1
    Join Date
    Dec 1969

    Default Wierd Error with code or database

    Anyone,<BR><BR>I have the following code to update a database from form results:<BR><BR>ZYourName = Request.Form ("YourName")<BR>ZYourEmail = Request.Form ("YourEmail")<BR><BR>Set Connect = Server.CreateObject("ADODB.Connection")<BR>Connect .Open "mindsite"<BR><BR>Set listing = Server.CreateObject("ADODB.Recordset")<BR>Strquery = ("Select * From mindsite")<BR>listing.Open Strquery, Connect, adOpenDynamic, adLockOptimistic<BR><BR><BR>listing.AddNew<BR>list ing("YourName")= ZYourName<BR>listing("YourEmail")= ZYourEmail<BR><BR>listing.Update <BR>listing.Close<BR>set listing=nothing<BR><BR>%&#062;<BR><BR>I keep getting the error:<BR>Can not Update. Database or record is read-only.<BR><BR>Any Ideas?<BR>

  2. #2
    Join Date
    Dec 1969

    Default RE: Wierd Error with code or database

    First thing-<BR>1. You have to specify which record you want to update and for this you have to pass a criteria as in a "where" clause.<BR>"select * from table where id=&#039000&#039"<BR>unless of course you want to do the batch updates.<BR>2. For updates you dont need to start with "Listing.addnew"<BR>just <BR>listing("YourName")= ZYourName<BR>listing("YourEmail")= ZYourEmail<BR><BR>listing.Update <BR>listing.Close<BR>set listing=nothing<BR><BR>Hope this helps.<BR>Good Luck<BR>:-)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts