home *** CD-ROM | disk | FTP | other *** search
/ Netrunner 2004 October / NETRUNNER0410.ISO / regular / ActivePerl-5.8.4.810-MSWin32-x86.msi / _5623c4f39d78ba5ca7bea58d44490a67 < prev    next >
Encoding:
Text File  |  2004-06-01  |  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