Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??
Please Brethren HELP
I am very new to SQL and ODBC (so please do help me). I have written the following simple code, which inserts an entry (record) into an access database. In order to establish and maintain referential integrity, I need to know the Index key value of this entry to tie it up with its sub records.
use strict; use Win32; use warnings 'all'; use Win32::ODBC; my $dsn = "test"; my $srv_tbl = "server_tbl"; my $drv_tbl = "drives_tbl"; my $srv = shift @ARGV; my $loc = shift @ARGV; my $notes = pop @ARGV; my $db = new Win32::ODBC( $dsn ) || die "\nError! $^E:$!\n"; $db->Sql("INSERT INTO $srv_tbl (srv_name, location, notes) VALUES ('$s +rv','$loc','$notes')"); my $sql= “select srv_id from server_tbl where srv_name='$srv'”; #this +bit doesn’t work print "Index Key: $sql\n"
This bit doen't work (my $sql= “select srv_id from server_tbl where srv_name='$srv'”); Can someone please get me out of my misery, and inform me why.

In reply to MS Access entry index key values by blackadder

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others rifling through the Monastery: (5)
As of 2024-04-19 07:30 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found