Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?
 
PerlMonks  

comment on

( #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 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? | Other CB clients
Other Users?
Others exploiting the Monastery: (3)
As of 2022-08-17 04:06 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?