http://qs321.pair.com?node_id=180522

blackadder has asked for the wisdom of the Perl Monks concerning the following question:

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.