www.webdeveloper.com
Results 1 to 4 of 4

Thread: Object closed

  1. #1
    Join Date
    Jul 2005
    Posts
    43

    Object closed please

    Hi guys, iīm having a problem with my recordset obj, it is opened but the system says itīs not, check out:

    code>>>>>>>>>>>

    set obj_rs = server.CreateObject ("adodb.recordset")
    caminho = left(Server.mappath(Request.ServerVariables("PATH_INFO")),InstrRev(Server.mappath(Request.ServerVari ables("PATH_INFO")),"\"))
    obj_rs.CursorLocation = adUseClient

    if q_id = "ok" then
    'this strSQL works
    strSQL = "SELECT * from " & q_tabela & " where email= '" & email & "' and cep='" & cep & "'"
    elseif q_id = "deletar" then
    'this strSQL doesnīt work
    strSQL = "DELETE from " & q_tabela & " where email= '" & email & "' and cep='" & cep & "'"
    else
    'this strSQL works
    strSQL = "SELECT * from " & q_tabela & " where email= '" & email & "'"
    end if

    obj_rs.Open strSQL, "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & caminho & "../dados/academiasonline.mdb", adOpenStatic , adLockReadOnly, adCmdText
    total_registros = obj_rs.RecordCount
    -------------------------------------------------

    The message that I get is that the object is closed when I go to q_id="deletar" but the others SELECT strSQL work. What can it be?!

    Thank you,
    Renato
    Last edited by renatois; 08-08-2005 at 08:02 PM.

  2. #2
    Join Date
    Jan 2004
    Location
    Melbourne, Australia
    Posts
    5,298
    A DELETE query will not return any records. Therefore, you cannot use it in conjunction with a RecordSet object.

    You should use the Execute function of the ADO Connection object.
    Code:
    Dim objConn
    Set objConn = Server.CreateObject("ADODB.Connection")
    objConn.Execute strSQL
    Regards.
    Last edited by buntine; 08-08-2005 at 08:09 PM.

  3. #3
    Join Date
    Jul 2005
    Posts
    43

    thanks

    thanks buntine, it worked very well.

  4. #4
    Join Date
    Jan 2004
    Location
    Melbourne, Australia
    Posts
    5,298

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

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



Recent Articles