Thanks for all the suggestions.  After checking them all I went back to RTFM.

I discovered there is a simpler, alternative way to passing parameters into a
stored procedure. Instead of trying to create and append parameters, simply pass
the parameter values as a list when you populate the CommandText attribute. See
the amended code.


use Win32::OLE;
$Conn = Win32::OLE->new( "ADODB.Connection");
$cm =  Win32::OLE->new( "ADODB.Command");
$RS =  Win32::OLE->new( "ADODB.RecordSet");
$Conn->Open('Northwind'); # or die "Cannot connect";

$qryCity = 'seattle';

 #  stored proc text :
 #       PARAMETERS pCity Text ( 255 );
 #       SELECT *
 #       FROM employees
 #       WHERE city = pCity;

$cm->{ActiveConnection} = $Conn;
$cm->{CommandType} = adCmdStoredProc;
#  list the parameter values after the name of the stored_proc which means that
#  now we don't need to create and append parameters.....
$cm->{CommandText} = "spEmployeeInCity ($qryCity)";
# ... and the next line now becomes superfluous
#$cm->Parameters->Append($cm->CreateParameter('pCity', adChar, adParamInput, 
25, $qryCity));
$RS = $cm->Execute();

#  process recordset here.......

$cm->Close;
$RS->Close;
$Conn->Close;



_______________________________________________
Perl-Win32-Users mailing list
[email protected]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

Reply via email to