I have an issue here using Win32::ODBC to get multiple queries from the same database or a different one. I originally tried to get fields from seperate tables, but now I have it doing the same exact query twice, just to illustrate that it doesn't work when I do the second query, but if I do just the first query I do get the expected data. Can anybody see anything here that might prevent my program from returning the results from the second query? Thanks
bW
#!/opt/perl/bin/perl use Win32::ODBC; use strict; my $outdir="//Cmdsrv02/EPIC_Users/Group_Share/Database/meetings/script +s/"; #MAKE CONNECTION AND QUERY ACCESS DATABASE my $connstring = "DRIVER=Microsoft Access Driver (*.mdb);DBQ=//Cmdsrv0 +2/EPIC_Users/Group_Share/Contacts/contacts.mdb"; my $db = new Win32::ODBC($connstring); $db->Sql("SELECT * FROM groups_in_disciplines"); #OPEN EXTERNAL LOGFILE open(LOGFILE, ">$outdir/events.txt"); while ($db->FetchRow()) { my $discipline_id = "discipline_id"; my $discipline = "discipline_id"; $discipline_id=$db->Data($discipline_id); my $db2 = new Win32::ODBC($connstring); $db2->Sql("SELECT * FROM groups_in_disciplines"); while ($db2->FetchRow()) { $discipline = $db2->Data($discipline); print LOGFILE $discipline, " "; # $discipline_id works } $db2->Close(); } close LOGFILE; $db->Close(); exit;
In reply to Win32::ODBC Multiple Queries by Willman023
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |