If you look at the Description section of Win32::OLE's documentation, the first two sentences are: "This module provides an interface to OLE Automation from Perl. OLE Automation brings VisualBasic like scripting capabilities and offers powerful extensibility and the ability to control many Win32 applications from Perl scripts."

Basically, that means you're not going to be able to run queries directly against a database using that module. Instead, it would allow you to control Windows applications (such as Microsoft Office products). If you want to run queries directly against a database, you might want to look into Win32::ODBC and/or DBD::ODBC.

Although it sounds like you're not allowed to install other modules, that may not be an issue. Here's info on 3 popular Perl distributions for Windows:

Also, I think there's more to your code than what you posted. In your posted code, it looks like $conn and $rs are objects, but those objects are not defined or created. And your posted code has an unfinished if statement. When I try running your code (with the if statement commented out), it bails on the $conn->open; line with the following error message: Can't call method "open" on unblessed reference at test.pl line 3.

In other words, your posted code doesn't reproduce the error messages that you say that you're seeing. Perhaps if you can share more information on your limitations and what you're trying to do or maybe some reduced code that can reproduce your error message, others might be able to help you out more.


In reply to Re: Perl OLE32 MSSQL SELECT dateadd function results in “Cursor type changed” error by dasgar
in thread Perl OLE32 MSSQL SELECT dateadd function results in “Cursor type changed” error by newbieperlperson

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.