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


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.