I am having to use Access with Perl on a Win95 machine for my development work :/
As I code in ASP and Perl (though ASP by twisted arm and Perl by pure pleasure) I already have the solution to my problem in ASP. Namely, grabbing the last insert ID in Access.
Dim rs,last_ID
Set rs = Server.CreateObject("ADODB.Recordset")
rs.Open "NOTICE", db_connection, adOpenKeySet, adLockPessimist
+ic, adCmdTable
rs.AddNew
rs("title").Value = title
rs("message").Value = message
rs("date_raised").Value = Date &" "& Time
rs("project_ID").Value = projectID
rs("issuer_ID").Value = userID
rs("notice_type").Value = ntype
rs.Update
last_ID = rs("ID")
rs.Close
Where 'rs' is my recordset and 'last_ID' is the value of the column 'ID' in that row. In other words, the column 'ID' is an autonumber column and the recordset does (what appears to be) some db cursor wizardry to get it back.
Now I could just modify the database and use a program generated timestamp and then select it back out - but on reading the Perl ADO docs and the ODBC docs for Perl, I ge the impression I can use OLE to create my object and do it that way. However, having never done this before I was hoping someone could shed some light on the subject.
Interestingly, in my searches on Google and such, I came across this link:
http://msdn.microsoft.com/library/default.asp?URL=/library/en-us/dnclinic/html/scripting012299.asp
Which I found most interesting - especially at the bottom of the post :)
As I am advocating Perl strongly where I work, I want to be able to port this directly rather than performing a work around. Hope someone can help!
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: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.