Sorry if I was a little obscure:

I am writing a proper Perl Script which is executed in a cgi-bin style directory under PWS. I am using the Template::Toolkit and the DBI for my functionality. I am using Access as a database which is connected to via an ODBC connection.

My problem is that I have to do multiple inserts into an Access database but all the inserts after the first insert utilise the ID column from that insert (ie a Foreign Key style relationship). Thus I need to get the last inserted ID from the first insert call and use it in all the remaining calls.

My options, that I can see, are to use a timestamp or to use the ADO along the lines I indicated in my ASP snippet.

I included the ASP snippet purely as an indicator that it is possible to do using a recordset object but I do not know how to build one in Perl.

My searches have only indicated that I can use Win32::OLE.

I should reiterate that PerlScript is not an option for a variety of reasons. Firstly, if I change my SQL I can plop it on a Unix server without changing a single line of code other than the various DBI calls. I will want to get my current program to work under Apache at some point in the near future :)

Secondly, there was no option to install PerlScript when I installed the latest MSI version of ActivePerl and to be frank - due to portability I have no intention of ever using it.

As my original post said - I only use ASP if someone twists my arm - and then I use VBScript!!

I don't think I can provide more info - theres no Perl code as if I could provide the Perl code I wouldn't be asking the question in the first place!! :) oh well!

In reply to Re: Re: A Question on ADO and a comment on Microsoft by simon.proctor
in thread A Question on ADO and a comment on Microsoft by simon.proctor

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.