Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

vb to perl

Status
Not open for further replies.

tswitz00

IS-IT--Management
Jan 26, 2005
67
US
I have this vb code that works like it is supposed to but I would like to write it in perl but I am having a little trouble with the conversion.
Here is the vb code
Code:
Dim DB 
Set DB = WScript.CreateObject("object.Name") 
DB.Open "Param1", "Param2", "Param3", "Param4"
    DB.Login "Username", "Password"
    DB.Contact.NewRecord
    DB.Contact.Value("LAST_NAME") = "Ztester"
    DB.Contact.Value("FIRST_NAME") = "Ztest"
    DB.Contact.Update
    DB.Logout
    DB.Close

WScript.Quit

And here is what I tried with the perl code
Code:
use Win32::OLE;

my $DB;
$DB = Win32::OLE->new('object.name');
$DB->Open('param1', 'param2', 'param3', 'param4');
$DB->Login('username', 'password');
$DB->Contact->NewRecord();
$DB->Contact->SetProperty("Value", 'FIRST_NAME', 'zTest');
$DB->Contact->SetProperty("Value", 'LAST_NAME', 'zTester');
$DB->Contact->Update();
$DB->Logout();
$DB->Close();

exit 0;

The open and login work fine as it should but when it gets down to adding a new record I get
"Can't call method "NewRecord" on an undefined value"

Any thoughts?

 
It looks like this is trying to connect to a database and perform record inserts. If so, take a look at the DBI module and DBD::ODBC module for doing the actual database connection.

- George
 
or WIN32:ODBC , which ships as standard with ActiveState PERL

"In complete darkness we are all the same, only our knowledge and wisdom separates us, don't let your eyes deceive you.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top