Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 5 of 5
  1. #1
    Regular Coder
    Join Date
    Mar 2006
    Posts
    187
    Thanks
    5
    Thanked 0 Times in 0 Posts

    Object invalid or no longer set.

    ok, im trying to add a record to an access databse using a stored query, but i am getting this error come up

    Code:
    The page cannot be displayed 
    There is a problem with the page you are trying to reach and it cannot be displayed. 
    
    --------------------------------------------------------------------------------
    
    Please try the following:
    
    Click the Refresh button, or try again later.
    
    Open the localhost home page, and then look for links to the information you want. 
    HTTP 500.100 - Internal Server Error - ASP error
    Internet Information Services
    
    --------------------------------------------------------------------------------
    
    Technical Information (for support personnel)
    
    Error Type:
    Microsoft JET Database Engine (0x80004005)
    Object invalid or no longer set.
    /forum4/signupnow.asp, line 124
    
    
    Browser Type:
    Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; FunWebProducts; SV1; FunWebProducts-MyWay; .NET CLR 1.1.4322) 
    
    Page:
    POST 429 bytes to /forum4/signupnow.asp
    
    POST Data:
    lasturl=http%3A%2F%2Flocalhost%2Fforum4%2F&name=Name&usr_gender=1&dob_day=1&dob_month=1&dob_year=2006&usr_twn=Some+Town&usr_post_code=POST&country=214&Email=email@email.com&usr_name=user+name&password . . . 
    
    Time:
    30 March 2006, 18:05:42 
    
    
    More information:
    Microsoft Support
    and the code im using to execute this stored query is:
    Code:
    Function addtodb()
    	addtodb = True
    
    	' ADO Constants
    	Const adCmdTableDirect = &H0200
    
    	' Connection String
    	Dim connStr
    	connStr = "Provider=Microsoft.Jet.OLEDB.4.0; Data Source=" & Server.MapPath("database.mdb")
    
    	' Recordset Object
    	Dim rs
    	Set rs = Server.CreateObject("ADODB.Recordset")
    	rs.Open "exec Add_New_User '" & request("usr_name") & "', '" & request("name") & "', '" & request("email") & "', '" & Request.ServerVariables("REMOTE_ADDR") & "', " & request("country") & ", '" & request("password") & "', '" & request("dob_day") & "/" & request("dob_month") & "/" & request("dob_year") & "', " & request("usr_gender") & ", '" & request("url") & "', '" & request("desc") & "', '" & request("usr_twn") & "', '" & request("usr_post_code") & "'", connStr, , , adCmdTableDirect
    	rs.close
    
    End Function
    Any help would be greatfully recieved.

  • #2
    Senior Coder nikkiH's Avatar
    Join Date
    Jun 2005
    Location
    Near Chicago, IL, USA
    Posts
    1,973
    Thanks
    1
    Thanked 32 Times in 31 Posts
    Not positive, but the ASP code I'm stuck maintaining doesn't use the open method of a recordset to execute a stored procedure.
    It makes the SQL, complete with exec call, as a string, then calls connection execute method.

    i.e. like this (modified for posting in a public forum)

    Set ObjRS = server.CreateObject("ADODB.RecordSet")
    strSQL = "SP_NAME '" & CDate(strSDate) & ... etc
    set ObjRS = objConn.Execute(strSQL)

    where objConn is an already open connection.

    Note that we use SQL Server, not Access, so could be a DBMS-specific thing.

    If this post contains any code, I may or may not have tested it. It's probably just example code, so no getting knickers in a bunch over a typo, OK? If it doesn't have basic error checking in it, such as object detection or checking if objects are null before using them, put that in there. I'm giving examples, not typing up your whole app for you. You run code at your own risk.
    Bored? Visit
    http://www.kaelisspace.com/

  • #3
    Regular Coder
    Join Date
    Mar 2006
    Posts
    187
    Thanks
    5
    Thanked 0 Times in 0 Posts
    one other thing i had noticed, was that although i got that error, the data was still being inserted in to the table.

  • #4
    Regular Coder
    Join Date
    Mar 2006
    Posts
    187
    Thanks
    5
    Thanked 0 Times in 0 Posts

    ok tryed the script

    but i dont know how to creat an open connection. any help would be good!

  • #5
    Senior Coder nikkiH's Avatar
    Join Date
    Jun 2005
    Location
    Near Chicago, IL, USA
    Posts
    1,973
    Thanks
    1
    Thanked 32 Times in 31 Posts

    If this post contains any code, I may or may not have tested it. It's probably just example code, so no getting knickers in a bunch over a typo, OK? If it doesn't have basic error checking in it, such as object detection or checking if objects are null before using them, put that in there. I'm giving examples, not typing up your whole app for you. You run code at your own risk.
    Bored? Visit
    http://www.kaelisspace.com/


  •  

    Posting Permissions

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