I am having a problem connecting to SQL Server. I have been using perl to
connect through ODBC to an MS Access database and everything was working
fine. Now I am plugging in a new ODBC connection to a SQL Server and I get
an error. I am hoping I am just making a syntax error.
The error I receive is:
Can't call method "Sql" on an undefined value at
c:\inetpub\wwwroot\ivm\test.pl line 10.
The code I am using is:
#!/usr/local/bin/perl
use Win32:
BC;
$dsn = "SQL_IMS_LOCAL";
$sql = "SELECT * FROM profiles WHERE emp_number=8908;";
$db = new Win32:
BC($dsn);
$db->Sql($sql);
($ErrNum, $ErrText, $ErrConn) = $db->Error();
if ($ErrNum) {
&printErrorHeader;
}
print <<ENDTEST;
Content type: text/html\n\n
<html>
<head><title>Test</title>
</head>
<body>
<table>
<tr>
<td>
ENDTEST
$db->FetchRow();
( $emp_number, $name, $password, $mas_loc, $email ) = $db->Data(
"emp_number", "name", "password", "mas_loc", "email" );
print "$emp_number, $name, $password, $mas_loc, $email<br>";
$db->Close();
print <<ENDTEST;
<br><br>test
</td>
</tr>
</table>
</body>
</html>
ENDTEST
--------== Posted Anonymously via Newsfeeds.Com ==-------
Featuring the worlds only Anonymous Usenet Server
-----------==
http://www.newsfeeds.com ==----------