update recored sql

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • zivon
    New Member
    • Aug 2007
    • 59

    update recored sql

    I'm making a form for changing a user password and information
    and tring to update the recoreds.

    maybe the problam has nothing to do with what I'm thinking.. but that is what I tried:

    when I try
    rs.Open strSQL, oconn
    or
    rs.Open strSQL, oconn, 3
    or
    rs.Open strSQL, oconn, 2
    or
    rs.Open strSQL, oconn, 1
    or
    rs.Open strSQL, oconn, -1

    I get this error:

    Error Type:
    ADODB.Recordset (0x800A0CB3)
    Current Recordset does not support updating. This may be a limitation of the provider, or of the selected locktype.
    /setup.asp, line 33

    when I try
    rs.Open strSQL, oconn, adOpenKeyset, adLockPessimist ic, adCmdText
    or
    rs.Open strSQL, oconn, 4

    I get this error:

    Error Type:
    ADODB.Recordset (0x800A0BB9)
    Arguments are of the wrong type, are out of acceptable range, or are in conflict with one another.
    /setup.asp, line 16
  • markrawlingson
    Recognized Expert Contributor
    • Aug 2007
    • 346

    #2
    Try rs.Open strSQL, oconn, 3, 3

    btw, the second error is probably appearing because your ADO constants aren't properly declared anywhere.

    Sincerely,
    Mark


    Originally posted by zivon
    I'm making a form for changing a user password and information
    and tring to update the recoreds.

    maybe the problam has nothing to do with what I'm thinking.. but that is what I tried:

    when I try
    rs.Open strSQL, oconn
    or
    rs.Open strSQL, oconn, 3
    or
    rs.Open strSQL, oconn, 2
    or
    rs.Open strSQL, oconn, 1
    or
    rs.Open strSQL, oconn, -1

    I get this error:

    Error Type:
    ADODB.Recordset (0x800A0CB3)
    Current Recordset does not support updating. This may be a limitation of the provider, or of the selected locktype.
    /setup.asp, line 33

    when I try
    rs.Open strSQL, oconn, adOpenKeyset, adLockPessimist ic, adCmdText
    or
    rs.Open strSQL, oconn, 4

    I get this error:

    Error Type:
    ADODB.Recordset (0x800A0BB9)
    Arguments are of the wrong type, are out of acceptable range, or are in conflict with one another.
    /setup.asp, line 16

    Comment

    • zivon
      New Member
      • Aug 2007
      • 59

      #3
      first thanks for answering.

      what you gave me give me the folloing error:

      Error Type:
      Microsoft OLE DB Provider for ODBC Drivers (0x80004005)
      [Microsoft][ODBC Microsoft Access Driver] Cannot update. Database or object is read-only.
      /setup.asp, line 42

      so I tried 3, 4

      and it didn't give me any error, but also didn't update the records : \

      maybe this is not the way ?
      rs("Email") = Request.Form("e mail")



      Originally posted by markrawlingson
      Try rs.Open strSQL, oconn, 3, 3

      btw, the second error is probably appearing because your ADO constants aren't properly declared anywhere.

      Sincerely,
      Mark

      Comment

      • idsanjeev
        New Member
        • Oct 2007
        • 241

        #4
        Hi
        If your error reported Cannot update. Database or object is read-only.
        please check your database permission and give permission to full control if have permission to read only
        thanks

        Comment

        • DrBunchman
          Recognized Expert Contributor
          • Jan 2008
          • 979

          #5
          The problem is you are trying to change a recordset object which is read-only.

          Have you tried updating the database like this:

          sSQL = "UPDATE Table1 SET Email = '" & Request.Form("e mail") & "' WHERE Something = '" & SomethingElse & "' "
          oConn.Execute sSQL

          oConn is your database connection object, Table1 is the name of your table and Something & SomethingElse is your condition e.g. username = 'Fred'

          If this doesn't work then you may have a permissions issue. Let me know how you get on.

          Dr B

          Comment

          • zivon
            New Member
            • Aug 2007
            • 59

            #6
            The file is not read-only, maybe the server managment, but I have no idea how to change it... its on my pc..

            any way, when I try the line you just gave me this is what I get:

            Error Type:
            Microsoft OLE DB Provider for ODBC Drivers (0x80004005)
            [Microsoft][ODBC Microsoft Access Driver] Operation must use an updateable query.
            /setup.asp, line 20


            this is the line:
            Code:
            	sSQL = "UPDATE Admin SET Email = '" & Request.Form("email") & "' WHERE User='" & Session("IdUser") & "'"



            Originally posted by DrBunchman
            The problem is you are trying to change a recordset object which is read-only.

            Have you tried updating the database like this:

            sSQL = "UPDATE Table1 SET Email = '" & Request.Form("e mail") & "' WHERE Something = '" & SomethingElse & "' "
            oConn.Execute sSQL

            oConn is your database connection object, Table1 is the name of your table and Something & SomethingElse is your condition e.g. username = 'Fred'

            If this doesn't work then you may have a permissions issue. Let me know how you get on.

            Dr B

            Comment

            • DrBunchman
              Recognized Expert Contributor
              • Jan 2008
              • 979

              #7
              I think I'm wrong then - it's nothing to do with the recordset and it is a permission problem <hangs head in shame>

              When you say the file I presume you mean the .mdb file? What sort of security are you using for your site?

              If it's anonymous has your IUSR_<machineNa me> account got appropriate read/write access?

              If it's Windows Authentication have you got sufficient security or are you in a group that has?

              Have you tried setting the connection mode prior to opening it e.g.

              Code:
              Set oConn = CreateObject("ADODB.Connection") 
              oConn.mode = 3
              Dr B

              Comment

              • idsanjeev
                New Member
                • Oct 2007
                • 241

                #8
                Hi zivon
                you are sure the database not read only or you don't know how to check it
                if you are using mode type suggested by experts then i think the problems to your database please check it by
                1) write click on database
                2) select properties
                3) select security and check permission full control
                if database is already checked full control then attached your code with a attachment .
                Thanks

                Comment

                Working...