danielemasson
Programmer
Hi every one .. im just having problems with the TEXT fields when selecting from a perl script, when selecting INT, VARCHAR, etc. theres no problem ... but when selecting TEXT fields the while (@row = fetch_qrray) doesnt retrieve anything ... heres the code ... any help will be very appreciated, is there something i shuld know about selecting this kind of fields ??? im running MS SQL 6.5 on Win NT 4.0. Thanks
use DBI;
use CGI;
$q = new CGI;
print $q->header();
$dbh = DBI->connect("DBI:ODBC
ATABASE","user","pass",{PrintError => '1'}) || print "CANT CONNECT";
# cabecera is a field of type TEXT !!
# if i only select 'codigo' it works perfect !!
$sth=$dbh->prepare("select codigo,cabecera from noticia where region='4' and seccion = '4'"
|| print "Can't prepare statement: $DBI::errstr";
$sth->execute || print "Can't prepare statement: $DBI::errstr";
print "Query will return $sth->{NUM_OF_FIELDS} fields.<br><br>";
print "Field names: @{ $sth->{NAME} }<br><br>";
my $hashrow;
while ($var = $sth->fetchrow_hashref) {
print "=> $var->{'codigo'} , $var->{'cabecera'}<br>";
}
use DBI;
use CGI;
$q = new CGI;
print $q->header();
$dbh = DBI->connect("DBI:ODBC
# cabecera is a field of type TEXT !!
# if i only select 'codigo' it works perfect !!
$sth=$dbh->prepare("select codigo,cabecera from noticia where region='4' and seccion = '4'"
$sth->execute || print "Can't prepare statement: $DBI::errstr";
print "Query will return $sth->{NUM_OF_FIELDS} fields.<br><br>";
print "Field names: @{ $sth->{NAME} }<br><br>";
my $hashrow;
while ($var = $sth->fetchrow_hashref) {
print "=> $var->{'codigo'} , $var->{'cabecera'}<br>";
}