Beefy Boxes and Bandwidth Generously Provided by pair Networks Joe
Welcome to the Monastery
 
PerlMonks  

Re^2: Question about joins?

by zackdade (Initiate)
on Jan 14, 2005 at 11:58 UTC ( [id://422314]=note: print w/replies, xml ) Need Help??

This is an archived low-energy page for bots and other anonmyous visitors. Please sign up if you are a human and want to interact.


in reply to Re: Question about joins?
in thread Question about joins?

excellent :) thanks here is the code.
$username="admin"; $pw="temppwd"; # connect to the named DSN, returns a database handle $dbh=new Win32::ODBC("DSN=APS;UID=$username;PWD=$pw;"); die "Unable to connect to DSN PerlSysAdm:" . Win32::ODBC::Error( ) . +"\n" unless (defined $dbh); $selst = "select APSVehicles.*, DlrLogins.* FROM APSVehicles INNER JOI +N DlrLogins ON APSVehicles.Dealer = DlrLogins.P1 or APSVehicles.Deale +r = DlrLogins.P2 WHERE DlrLogins.UserID = '$AuthUser' ORDER by DLRID" +; print "<BR>$selst<BR>\n"; $rc = $dbh->Sql($selst); die "Error: " . Win32::ODBC::Error( ) . "\n"; $results = $dbh->RowCount( ); $a = 1; $temp = 0; while ($dbh->FetchRow( )) { push(@AutoActive,$dbh->Data("AutoActive")); push(@Tag,$dbh->Data("Tag")); push(@Dealer,$dbh->Data("Dealer")); push(@YrMade,$dbh->Data("YrMade")); push(@Make,$dbh->Data("Make")); push(@Model,$dbh->Data("Model")); push(@ExtCol,$dbh->Data("ExtCol")); push(@Price,$dbh->Data("Price")); push(@DateAdded,$dbh->Data("DateAdded")); push(@FinanceAvail,$dbh->Data("FinanceAvail")); $a = ++$a; } $dbh->DropCursor( ); $dbh->Close( );
Thanks - Zack

Replies are listed 'Best First'.
Re^3: Question about joins?
by Grygonos (Chaplain) on Jan 14, 2005 at 14:32 UTC
    I would reccomend an on the fly connect, in order to reduce dependence on the DSN being setup.
    my $dbh = DBI->connect('dbi:ODBC:driver=SQL Server;server=192.168.x.x; +database=My Database;app=my database application',$user,$pass);

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://422314]
help
Sections?
Information?
Find Nodes?
Leftovers?
    Notices?
    hippoepoptai's answer Re: how do I set a cookie and redirect was blessed by hippo!
    erzuuliAnonymous Monks are no longer allowed to use Super Search, due to an excessive use of this resource by robots.