I have a question for the mighty monks...I can't figure out why recordsets I create with the Win32::OLE module, can't use the filter property.
use strict; use Win32::OLE; use Win32::OLE::Const; use Win32::OLE::Variant; my $Constname = "Microsoft ActiveX Data Objects 2\\.0 Library"; my $ado_consts = Win32::OLE::Const->Load($Constname); my $database = "somedb"; my $hostname = "somehost"; my $port = "someport"; my $user = "user"; my $password = "pass"; my $conn = Win32::OLE->new("ADODB.Connection"); $conn->{"ConnectionString"} = "Provider=SQLOLEDB.1;User ID=$user;Passw +ord=$pass;Initial Catalog=$database;Data Source=$hostname"; $conn->open(); my $recordSet = Win32::OLE->new("ADODB.RecordSet"); my $sql = "select * from table"; $recordSet->{"ActiveConnection"} = $conn; $recordSet->{"CursorLocation"} = 3; $recordSet->{"CursorType"} = 1; $recordSet->{"LockType"} = 3; $recordSet->open($sql); print $recordSet->Supports($ado_consts->{"adBookmark"})."\n"; my $myFilter = "Where Clause without the where"; $recordSer->Filter => $myFilter while (! $recordSet->EOF) { print $recordSet->Fields(0)->value."\n"; $recordSet->MoveNext; } print "\n";
now the supports function returns a 1 for 0x2000 or adBookmark so I should Be able to use the Filter Property, and i get an error instead telling me that the Filter Property doesn't exist. To be exact i get:
Win32::OLE(0.1403) error 0x8002000e: "Invalid number of parameters" in METHOD/PROPERTYGET "Item" at (eval 409)[e:/PROGRA~1/ACTIVE~1//p +erl5db.pl: 1556] line 2
And i have also noticed that the Properties->Item value is undef, even though the Properties->Count values is 103. Whatever Wisdom the monks Give Would be Greatly Appreciated. Thanks In advance, ketema

In reply to OLE ADO & Win32 by ketema

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.