this is strange

I am reading from a database which was created by Online Store Builder 3.0 (an 
e-commerce program)
well OSB generates this database file for every store that is on the server, the 
database contains all the attributes for the store, well I need to read in all the 
items that the store has. In the database there is a table called items, and in this 
table is all the attributes for all the items, well I can read in all the attributes 
successfully using the asterisk, but I dont need all of them, so if I specify the 
columns manually(IE: SELECT thisC,thatC,oneC,twoC FROM some_table), when I get to 
using more than 3 columns, and try to print the 3rd columns, thats when it crashes,  I 
havent quite figured out what part of the script is actually crashing perl, if its the 
calling in all the different columns, or if its the printing of it.... but... I think 
its my print statement. 

this is the code that works:

#!E:\Perl\bin\perl.exe

use DBI;

$dbh = DBI->connect('dbi:ODBC:osbstore'); 
$sqlstatement = "SELECT ID,ItemID,ItemName FROM ITEMS"; 

$sth = $dbh->prepare($sqlstatement);
$sth->execute || die "could not execute $sqlstatement: $!";

print "Content-type:text/html\n\n";
print "\<pre\>";
while($row=$sth->fetchrow_hashref){
  print "ID: $row->{ID}\n";
  print "Item ID: $row->{ItemID}\n";
  print "Item Name: $row->{ItemName}\n\n";
 }
print "\<\/pre\>";

this is the code that crashes:

#!E:\Perl\bin\perl.exe

use DBI;

$dbh = DBI->connect('dbi:ODBC:osbstore');
$sqlstatement = "SELECT ID,ItemID,ItemName,Description FROM ITEMS";

$sth = $dbh->prepare($sqlstatement);
$sth->execute || die "could not execute $sqlstatement:";

print "Content-type:text/html\n\n";
print "\<pre\>";
while($row=$sth->fetchrow_hashref){
  print "ID: $row->{ID}\n";
  print "Item ID: $row->{ItemID}\n";
  print "Item Name: $row->{ItemName}\n";
  print "Item Description: $row->{Description}\n\n";
 }
print "\<\/pre\>";

the error i get when it crashes is "perl.exe has preformed errors, and must be 
restarted" or something to that effect
ps. incase you didnt figure it out im on windows 2000 machine :(
any help would be awsome!!

nate brunson

Reply via email to