Dear All, I want to fetch values from stored procedure.I am calling stored procedure from perl script in window system and connecting it to sql server.while running this code it gives me error:Can't call method "Fields" on an undefined value at line $RS = $oSP->Execute(); Please help...
use Win32::OLE; $ConnStr = "DSN=dsn_name;UID=abcd;PWD=password;APP=test;WSID=Mycomp;DA +TABASE=db_name"; $Conn = Win32::OLE->new('ADODB.Connection'); $Conn->Open($ConnStr); #Get record set results from store procedure $oSP = Win32::OLE->new("ADODB.Command"); $RS = Win32::OLE->new("ADODB.Recordset"); $oSP->{'CommandText'} = "exec dbo.sp_reportBytes '%','%','%','%', '200 +9-1-1', '2010-1-1', 'Admin', '530', NULL;"; $oSP->{'CommandType'} = 4; $oSP->{'ActiveConnection'} = $Conn; $oSP->{'CommandTimeout'} = 1200000; $oSP->{'@Param1'} = $Param1; $RS = $oSP->Execute(); while (! $RS->EOF) { $value = $RS->Fields(1)->value; print "$value\n"; $RS->MoveNext; }
In reply to Running stored procedure through perl script by chandanperl
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |