/ Forside / Teknologi / Udvikling / Perl / Nyhedsindlæg
Login
Glemt dit kodeord?
Brugernavn

Kodeord


Reklame
Top 10 brugere
Perl
#NavnPoint
bjarneA 141
poul_from 50
soccer 30
Nicknack 14
Tmpj 0
Connecting to SQL Server through ODBC usin~
Fra : Anonymous


Dato : 08-05-01 17:30

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 ==----------

 
 
Søg
Reklame
Statistik
Spørgsmål : 177560
Tips : 31968
Nyheder : 719565
Indlæg : 6408943
Brugere : 218888

Månedens bedste
Årets bedste
Sidste års bedste