home *** CD-ROM | disk | FTP | other *** search
/ PC World 2003 March / PCWorld_2003-03_cd.bin / Software / Topware / activeperl / ActivePerl / Perl / eg / aspSamples / setup.pl < prev    next >
Encoding:
Text File  |  2000-03-14  |  819 b   |  45 lines

  1. use Win32::OLE;
  2.  
  3. $conn = new Win32::OLE('Adodb.Connection');
  4.  
  5. $conn->Open(<<EOF);
  6.           Provider=SQLOLEDB;
  7.           Persist Security Info=False;
  8.           User ID=sa;
  9.           Initial Catalog=Northwind;
  10. EOF
  11.  
  12. checkerror();
  13.  
  14.  
  15. $conn->Execute("DROP Proc Test");
  16. $conn->Execute("DROP Proc get_customer");
  17.  
  18.   $conn->Execute(<<EOF);
  19.         CREATE PROC Test 
  20.         AS
  21.         RETURN(64)
  22. EOF
  23.  
  24. checkerror();
  25.  
  26.   $conn->Execute(<<EOF);
  27.         CREATE PROC get_customer \@cust_id nchar(5)
  28.         AS
  29.         SELECT * FROM Customers WHERE CustomerID=\@cust_id
  30. EOF
  31.  
  32. checkerror();
  33.  
  34. sub checkerror {
  35.     if( $conn->Errors->{Count} ) {
  36.       foreach $error (Win32::OLE::in($conn->Errors)) {
  37.       print $error->{Description};
  38.       }
  39.     }
  40. }
  41.  
  42.  
  43. #CREATE PROCEDURE Test AS
  44. #RETURN 64
  45. #GO