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 6 of 6
  1. #1
    New to the CF scene
    Join Date
    Jun 2008
    Posts
    6
    Thanks
    0
    Thanked 0 Times in 0 Posts

    VBScript problem

    Hellow, have problem getting result out of SQL JOB.
    In older version of VBScript this code belove was working find but now updating my VBScript version it doesn't work maybe someone can help me ?

    Code:
    // the code runs good in sql analayzer.
    query = "USE msdb EXEC sp_help_job NULL, 'job_debt_months', 'JOB'"
    set job = link.execute(query)
    
    query = "USE msdb EXEC sp_help_job NULL, 'job_debt_months_recount', 'JOB'"
    set job_re = link.execute(query)
    Code:
    if job("last_run_date") = 0 and job_re("last_run_date") = 0 then
                   datetime = "N/A"
              elseif job_last_run_dt > job_re_last_run_dt then
                   datetime = format_date(job("last_run_date")) &" "& format_time(job("last_run_time"))
               else
                    datetime = format_date(job_re("last_run_date")) &" "& format_time(job_re("last_run_time"))
              end if

    Error is:

    Code:
    ADODB.Recordset error '800a0cc1' 
    Item cannot be found in the collection corresponding to the requested name or ordinal
    Help someone please.

  • #2
    Regular Coder
    Join Date
    Mar 2008
    Posts
    235
    Thanks
    6
    Thanked 21 Times in 20 Posts
    check your database/table name. Looks like its wrong. Failing that check your pointing at the correct host.

    Hope that helps!
    Andrew Sharman
    Web designer, developer and programmer.

    If you found my post helpful, why not give thanks! :)

  • #3
    Supreme Master coder! Old Pedant's Avatar
    Join Date
    Feb 2009
    Posts
    27,084
    Thanks
    80
    Thanked 4,552 Times in 4,516 Posts
    No, it's not the table name.

    It's one of the field names. That's where that message comes from, when it mentions the recordset.

    And if the code worked before, I'd bet that the problem is in the stored procedure, not in the VBS code.

    I'd bet the SP is getting *two* (or more) recordsets, and the first one is empty or irrelevant.

    Without seeing the SP code, can't possibly tell.

  • #4
    New to the CF scene
    Join Date
    Jun 2008
    Posts
    6
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by Old Pedant View Post
    No, it's not the table name.

    It's one of the field names. That's where that message comes from, when it mentions the recordset.

    And if the code worked before, I'd bet that the problem is in the stored procedure, not in the VBS code.

    I'd bet the SP is getting *two* (or more) recordsets, and the first one is empty or irrelevant.

    Without seeing the SP code, can't possibly tell.
    It's not table or database coz in old version everything was woring good.
    I will try to get a code from JOB.

  • #5
    New to the CF scene
    Join Date
    Jun 2008
    Posts
    6
    Thanks
    0
    Thanked 0 Times in 0 Posts
    I tried use simple jobs for testing but didn't found no problem in my JOB.
    JOB is running good and finishing w/o no errors.
    I see that in my VBScript code is everything good and
    have no clue what can be wrong.
    We have upgrated MS SQL from 2003 to 2008.
    And the server is the same MS Server 2003 IIS v6.0.
    Few days we had new folder aspnet_client but searching via google found that it's not necesery folder if I'm using .NET v2.0
    Permission are good too but still no clue

  • #6
    New to the CF scene
    Join Date
    Jun 2008
    Posts
    6
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Now I'm just coding VBScript to C#.
    Coz in C# the same job works fine .
    Thanks for advices


  •  

    Posting Permissions

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