Loading ...
Sorry, an error occurred while loading the content.
 

Sorry!

Expand Messages
  • Eric Thibodeau
    I would like to appolagize for many of my postings appeared in double due to a MICROSOFT EXCHANGE MAIL server screw up here at the office...SORRY! Eric
    Message 1 of 6 , Mar 30, 2001
      I would like to appolagize for many of my postings appeared in
      double due to a MICROSOFT EXCHANGE MAIL server screw up here at the
      office...SORRY!

      Eric Thibodeau
      (514) 374-6204 x453
      ELECTROLINE R&D
    • Oliver Manickum
      Hey Guys, I am opening a connection to a database via ODBC on NT Server 4.0 and am trying to retrieve the value of a datetime field. I am getting this
      Message 2 of 6 , Apr 3, 2001
        Hey Guys,


        I am opening a connection to a database via ODBC on NT Server 4.0 and am
        trying to retrieve the value of a datetime field.

        I am getting this /Win32::OLE::Variant=SCALAR(0x39c6680)/ rather than the
        value. I am using Active Perl 618, I am new to Active Perl and would
        appreciate some help.


        Here is some of the code...

        $sql = "Select name, datefield from tblDemo";

        $Conn = $Server->CreateObject("ADODB.Connection");
        $Conn->Open($dsn);

        $RS = $Conn->Execute($sql);


        $name = $RS->Fields("name")->value;
        $datefield = $RS->Fields("datefield")->value;


        $RS->Close();
        $Conn->Close();


        Now I get the name, but i get the Scalar stuff when it comes to the date
        field. If i change the property of the field to string.. then it works, *but
        that is not acceptable*.

        Any clues ?

        - Olly
      • Zabil Cheriya Maliackal
        I had raised the same problem, And no one came to my help so I found the solution myself. When you return date using the fields collection in the recordset
        Message 3 of 6 , Apr 3, 2001
          I had raised the same problem,
          And no one came to my help so I found the solution myself.
          When you return date using the fields collection in the recordset object of
          the ADO or ODBC or whatever ie using the return for date is an object.
          The best way is to use this subroutine

          sub RefOrValue
          {
          my($RefValue) = @_;
          return (ref($RefValue) eq 'Win32::OLE::Variant') ?
          $RefValue->Date("dd MMM yy") : $RefValue;
          }

          include this in your code.
          Now is $Recordset is your ADO object
          Call the call the fields collection like this

          RefOrValue ($RS->Fields($i)->value);

          Please note that you can modify Date format by modifying the ("dd MMM yy")
          that is the coolest part.

          This is bound to work .
          If not kick me.
          All the best
          Zabil
          ----------
          From: Oliver Manickum [SMTP:oliver@...]
          Sent: Tuesday, April 03, 2001 4:24 PM
          To: perl-beginner@yahoogroups.com
          Subject: [PBML] SQL DateTime Column

          Hey Guys,


          I am opening a connection to a database via ODBC on NT
          Server 4.0 and am
          trying to retrieve the value of a datetime field.

          I am getting this /Win32::OLE::Variant=SCALAR(0x39c6680)/
          rather than the
          value. I am using Active Perl 618, I am new to Active Perl and
          would
          appreciate some help.


          Here is some of the code...

          $sql = "Select name, datefield from tblDemo";

          $Conn = $Server->CreateObject("ADODB.Connection");
          $Conn->Open($dsn);

          $RS = $Conn->Execute($sql);


          $name = $RS->Fields("name")->value;
          $datefield = $RS->Fields("datefield")->value;


          $RS->Close();
          $Conn->Close();


          Now I get the name, but i get the Scalar stuff when it
          comes to the date
          field. If i change the property of the field to string.. then it
          works, *but
          that is not acceptable*.

          Any clues ?

          - Olly





          ------------------------ Yahoo! Groups Sponsor



          Your use of Yahoo! Groups is subject to
          http://docs.yahoo.com/info/terms/
        • Zabil Cheriya Maliackal
          Oliver, If you want a direct hard coded mechanism then change the line $datefield = $RS- Fields( datefield )- value; to $datefield =
          Message 4 of 6 , Apr 3, 2001
            Oliver,
            If you want a direct hard coded mechanism then change the line
            $datefield = $RS->Fields("datefield")->value;
            to
            $datefield = $RS->Fields("datefield")->value->Date("dd MMM
            yy");

            and enjoy.

            ----------
            From: Oliver Manickum [SMTP:oliver@...]
            Sent: Tuesday, April 03, 2001 4:24 PM
            To: perl-beginner@yahoogroups.com
            Subject: [PBML] SQL DateTime Column

            Hey Guys,


            I am opening a connection to a database via ODBC on NT
            Server 4.0 and am
            trying to retrieve the value of a datetime field.

            I am getting this /Win32::OLE::Variant=SCALAR(0x39c6680)/
            rather than the
            value. I am using Active Perl 618, I am new to Active Perl and
            would
            appreciate some help.


            Here is some of the code...

            $sql = "Select name, datefield from tblDemo";

            $Conn = $Server->CreateObject("ADODB.Connection");
            $Conn->Open($dsn);

            $RS = $Conn->Execute($sql);


            $name = $RS->Fields("name")->value;
            $datefield = $RS->Fields("datefield")->value;


            $RS->Close();
            $Conn->Close();


            Now I get the name, but i get the Scalar stuff when it
            comes to the date
            field. If i change the property of the field to string.. then it
            works, *but
            that is not acceptable*.

            Any clues ?

            - Olly





            ------------------------ Yahoo! Groups Sponsor



            Your use of Yahoo! Groups is subject to
            http://docs.yahoo.com/info/terms/
          • Oliver Manickum
            You are the MAN ! hehehe muchos gracias - Olly ... From: Zabil Cheriya Maliackal [mailto:zabilcm@mascotsystems.com] Sent: 03 April 2001 01:32 To:
            Message 5 of 6 , Apr 3, 2001
              You are the MAN ! hehehe

              muchos gracias

              - Olly

              -----Original Message-----
              From: Zabil Cheriya Maliackal [mailto:zabilcm@...]
              Sent: 03 April 2001 01:32
              To: perl-beginner@yahoogroups.com
              Subject: RE: [PBML] SQL DateTime Column


              Oliver,
              If you want a direct hard coded mechanism then change the line
              $datefield = $RS->Fields("datefield")->value;
              to
              $datefield = $RS->Fields("datefield")->value->Date("dd MMM
              yy");

              and enjoy.

              ----------
              From: Oliver Manickum [SMTP:oliver@...]
              Sent: Tuesday, April 03, 2001 4:24 PM
              To: perl-beginner@yahoogroups.com
              Subject: [PBML] SQL DateTime Column

              Hey Guys,


              I am opening a connection to a database via ODBC on NT
              Server 4.0 and am
              trying to retrieve the value of a datetime field.

              I am getting this /Win32::OLE::Variant=SCALAR(0x39c6680)/
              rather than the
              value. I am using Active Perl 618, I am new to Active Perl and
              would
              appreciate some help.


              Here is some of the code...

              $sql = "Select name, datefield from tblDemo";

              $Conn = $Server->CreateObject("ADODB.Connection");
              $Conn->Open($dsn);

              $RS = $Conn->Execute($sql);


              $name = $RS->Fields("name")->value;
              $datefield = $RS->Fields("datefield")->value;


              $RS->Close();
              $Conn->Close();


              Now I get the name, but i get the Scalar stuff when it
              comes to the date
              field. If i change the property of the field to string.. then it
              works, *but
              that is not acceptable*.

              Any clues ?

              - Olly





              ------------------------ Yahoo! Groups Sponsor



              Your use of Yahoo! Groups is subject to
              http://docs.yahoo.com/info/terms/





              Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
            • Doug Wells
              It looks like you already have your answer, but I will give my two cents as well. I would suggest that you try using the DBI module that allows connectivity to
              Message 6 of 6 , Apr 3, 2001
                It looks like you already have your answer, but I will
                give my two cents as well. I would suggest that you
                try using the DBI module that allows connectivity to
                databases and supports a large assortment of
                procedures. I can give specifics if you like, but
                probably is easiest for you to look at the module on
                CPAN.

                Good luck,
                Doug


                --- Oliver Manickum <oliver@...> wrote:
                > Hey Guys,
                >
                >
                > I am opening a connection to a database via ODBC on
                > NT Server 4.0 and am
                > trying to retrieve the value of a datetime field.
                >
                > I am getting this
                > /Win32::OLE::Variant=SCALAR(0x39c6680)/ rather than
                > the
                > value. I am using Active Perl 618, I am new to
                > Active Perl and would
                > appreciate some help.
                >
                >
                > Here is some of the code...
                >
                > $sql = "Select name, datefield from tblDemo";
                >
                > $Conn = $Server->CreateObject("ADODB.Connection");
                > $Conn->Open($dsn);
                >
                > $RS = $Conn->Execute($sql);
                >
                >
                > $name = $RS->Fields("name")->value;
                > $datefield = $RS->Fields("datefield")->value;
                >
                >
                > $RS->Close();
                > $Conn->Close();
                >
                >
                > Now I get the name, but i get the Scalar stuff
                > when it comes to the date
                > field. If i change the property of the field to
                > string.. then it works, *but
                > that is not acceptable*.
                >
                > Any clues ?
                >
                > - Olly
                >
                >
                >
                >
                >


                __________________________________________________
                Do You Yahoo!?
                Get email at your own domain with Yahoo! Mail.
                http://personal.mail.yahoo.com/
              Your message has been successfully submitted and would be delivered to recipients shortly.