CFF KB - Carrz-Fox-Fire Promotions Knowledge Base

CFF KB is all about 1 thing: The Sharing of Knowledge and the Power we gain from it.
  • Breadrumbs:
  • Microsoft VBScript runtime (0x800A01A8) Object required: '

  • CFF Knowledge Base - Share With Facebook CFF Knowledge Base - Share on Twitter CFF Knowledge Base - Share on Reddit CFF Knowledge Base - Share on Digg It CFF Knowledge Base - Share on Stumble Upon It CFF Knowledge Base - Share on Delicious
    Share With Friends (Updated 6-8-2010)
  • Article ID:
    88
  • Date Created
    Monday, January 3, 2011
  • This Article Has been Viewed
    2716 times
  • Short Desc
    When you use a RecordSet to check if something exist or not, you have to make sure that the recordset if actually being used in the Queried page.
  • Details
    When you use a RecordSet to check if something exist or not, you have to make sure that the recordset if actually being used in the Queried page. If it is not being used, then you will recieve the following error.


     
    Microsoft VBScript runtime (0x800A01A8)
    Object required: ''
    /Comment.asp, line 15
  • Recreate Issue
    To recreate this issue.

    In this demostration we are going to be on page:
    page.asp?Type=Value
    Now, in the script, we are going to do this:

    <%
    if request.querystring("Type")="Home" then
    Set sql = Server.CreateObject("ADODB.Command")
    sqlch.ActiveConnection=RHCConn
    sqlch.Prepared = true
    sqlch.commandtext="select pid, dsid from MyTable where pid=? and sid=?"
    sqlch.Parameters.Append sqlchFriends.CreateParameter("@pid", adInteger, adParamInput, , getid)
    set rsch = sqlch.execute
    end if
    %>

    Now, in the above demostration, we are on page:
    page.asp?Type=Value
    And the RecordSet that we are needing to get our Query from is hidden in
    page.asp?Type=Home
    So we cannot use it Values until we correct the issue.
  • Resolve Issue
    To resolve this issue:

    OK, as demostrated in the above scenario, we have a page.asp?Type=Value that is trying to use the the RecordSet rsch
    Now, due to the fact that it is hidden behind another Query name, we are unable to use it.
    So, lets correct this issue now.

    <%
    if request.querystring("Type")="Home" or request.querystring("Type")="Value" then
    Set sql = Server.CreateObject("ADODB.Command")
    sqlch.ActiveConnection=RHCConn
    sqlch.Prepared = true
    sqlch.commandtext="select pid, dsid from MyTable where pid=? and sid=?"
    sqlch.Parameters.Append sqlchFriends.CreateParameter("@pid", adInteger, adParamInput, , getid)
    set rsch = sqlch.execute
    end if
    %>

    As you can see in the above, instead of creating another RecordSet to be used in another aarea, we instead added the OR to add in another QueryString to check for to use.
    Now, this will run and we can use the rsch recordset in both places.