...

View Full Version : VBScript problem



wtfn00b
06-26-2009, 07:49 AM
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 ?



// 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)



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:


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


Help someone please.

udjamaflip
06-26-2009, 10:38 AM
check your database/table name. Looks like its wrong. Failing that check your pointing at the correct host.

Hope that helps! :thumbsup:

Old Pedant
06-27-2009, 03:41 AM
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.

wtfn00b
06-27-2009, 09:41 AM
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.

wtfn00b
06-27-2009, 01:58 PM
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 :(

wtfn00b
06-29-2009, 02:35 PM
Now I'm just coding VBScript to C#.
Coz in C# the same job works fine .
Thanks for advices ;)



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum