I found variants frustrating when I first dug into them, too. However, this is no different than other languages that have peculiar handling of certain types; for instance VB requires you use 'SET' when assigning an object to variable or property. This is just part of learning the language and the libraries one uses.

What language was used when developing the applications that expect ADO date field values to return a string? I see this problem a lot when people attempt to port a VB example to Perl. ADO is made to work most easily with VB. The Win32::OLE::Variant module handles the datatypes in VB that in part make ADO so easy to use in VB.

Perl and ADO can co-exist and I find them very useful (especially when calling stored procedures with many arguments)--but using Perl and ADO together is harder than the other usual combinations of Perl/DBI or VB/ADO.

In short, I wouldn't guage my decision whether to continue using Perl on how difficult is was to get Perl/ADO working properly.

That said (and since this is PM, it had to be said first) there is another option. You can craft your SQL queries to solve this problem for you.
select CONVERT(varchar(30),date_fieldname,120) as date_fieldname from +...
By using CONVERT (use CAST if ANSI compatible--check syntax), you can return a datefield as a string and should be able to avoid changing lots of code (as you indicated you would have to). I think there is an implicit conversion during updates, so strings can be used when writing to a date field.

If your data provider/data source doesn't support ANSI or TSQL, this SQL fix may not be possible.

Update: added bits about non-TSQL databases.

--
May the Source be with you.

You said you wanted to be around when I made a mistake; well, this could be it, sweetheart.


In reply to Re^3: ADO Date Problems by Solo
in thread ADO Date Problems by Anonymous Monk

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.