Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses
 
PerlMonks  

Re: update database question

by VSarkiss (Monsignor)
on Jun 23, 2005 at 14:12 UTC ( [id://469399]=note: print w/replies, xml ) Need Help??


in reply to update database question

The only thing that sub is doing is opening a connection, whereas your title seems to indicate you're doing an update -- someplace else in your code, maybe?

The exact equivalent to your sub, using DBI and DBD::ADO is this:

use DBI; sub open_conn { # join isn't stricly necessary, # it just improves readability. my $strConnect = join ';', 'Provider=SQLOLEDB.1', 'Data Source=iblons3506\oi_c1_prd4', 'Initial Catalog=OMDPortal', 'User ID=OMDPortal_General', 'Password=ObFuScAtEd'; my $dbh = DBI->connect("dbi:ADO:$strConnect", '', '') or die "Can't connect: $DBI::errstr\n"; }
That snippet shares some of the problems in the VB code: it doesn't do anything intelligent if the connection fails (just dies), and it uses embedded passwords. But this one does return a value, the database handle (presumably in your VB program oConn is a global?)

But the point is, you can see how I mechanically translated your code. Depending on how dependent on ADO your code is, you may want to change the code more to take advantage of Perl's capabilities, or just translate part by part, using Win32::OLE or some such.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://469399]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others avoiding work at the Monastery: (2)
As of 2024-04-19 21:31 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found