Perl Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsProgramming LanguagesPerl Programming

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
Stay one step ahead of the competition. Evaluate and give feedback on some of the hottest web development tools on the market today. Make your opinion heard! Click Here
  #1  
Old October 27th, 2000, 03:57 AM
chrisdice4 chrisdice4 is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Aug 2000
Location: Cape Town, WP, South Africa
Posts: 39 chrisdice4 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 8
Hi there

My script wont excecute is there anybody got any ideas

#cerlbinperl.exe;

use CGI;
use DBI;

$q = new CGI;


$dir = $q->param('direction');

$month = $q->param('month');

if($dir eq 'e' | | $dir eq 'n')
{$monex = $month}



if($dir eq 's' | | $dir eq 'w' )
{$monimp = $month}


if ($monex > 0)
{$qline = "((Max(DatePart('m',[Port Departure Date])))= $monex))";
}
elsif ($monimp > 0)
{$qline = "((Min(DatePart('m',[Port Arrival Date])))= $monimp))";
}

if($month == 1)
{$monthead = 'January'}
elsif($month == 2)
{$monthead = 'Febuary'}
elsif($month == 3)
{$monthead = 'March'}
elsif($month == 4)
{$monthead = 'April'}
elsif($month == 5)
{$monthead = 'May'}
elsif($month == 6)
{$monthead = 'June'}
elsif($month == 7)
{$monthead = 'July'}
elsif($month == 8)
{$monthead = 'August'}
elsif($month == 9)
{$monthead = 'September'}
elsif($month == 10)
{$monthead = 'October'}
elsif($month == 11)
{$monthead = 'November'}
elsif($month == 12)
{$monthead = 'December'}



print $q->header;
print "<html>
<head>
</head>
<body>
<h1>$monthead DRS Voyages </h1><br>
<h2>Direction = $dir</h2>
<table>
<tr>
<th>Voyage</th><th>Date</th>
</tr>";

$dbh = DBI->connect('DBI:ODBC:salesforecast',' ',' ')
| | die print "cant connect to ODBC";

$sth = $dbh->prepare("SELECT Schedule_Auto_Report.[Voyage Identifier],
[Voyage Direction].[Voyage Direction],
Schedule_Auto_Report.Route,
Min(Schedule_Auto_Report.[Port Arrival Date]),
Max(Schedule_Auto_Report.[Port Departure Date]),
Min(DatePart('m',[Port Arrival Date])),
Min(DatePart('yyyy',[Port Arrival Date])),
Max(DatePart('m',[Port Departure Date])),
Max(DatePart('yyyy',[Port departure Date]))
FROM Schedule_Auto_Report
INNER JOIN [Voyage Direction]
ON Schedule_Auto_Report.[Voyage Identifier] = [Voyage Direction].[Voyage Identifier]
WHERE (((Schedule_Auto_Report.[Port Code]) Like 'za*'))
GROUP BY Schedule_Auto_Report.[Voyage Identifier],
[Voyage Direction].[Voyage Direction],
Schedule_Auto_Report.Route
HAVING ((([Voyage Direction].[Voyage Direction])='$dir')
AND $qline")| | die print "the query is the problem";

$sth->execute | | die print "cant excecute";

while (@row=$sth->fetchrow) {
print "<tr><td>$row[0]</td>
<td>$row[3]</td></tr>";
}

print "</table>
</body>
</html>";

$sth->finish;
$dbh->disconnect;

Reply With Quote
  #2  
Old October 28th, 2000, 06:49 PM
christucker2 christucker2 is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Aug 2000
Posts: 81 christucker2 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 8
Two things:

1) Windows doesn't recognise the #!<command interpreter> syntax at the start of the document. You'll have to run the script as perl <scriptname>

2) If you were on a unix system, it wouldn't work because that first line has to start #! and not just #

If you don't like having to manually invoke the perl interpreter every time you want to use your script, write a batch script to do it.

Reply With Quote
  #3  
Old October 29th, 2000, 06:31 PM
E. Watson E. Watson is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Oct 2000
Posts: 0 E. Watson User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
I concur with christuckers reply. In case you aren't familiar with writing the batch file. Open notepad and simply type the following: cerlbinperl.exe scriptname

Your scriptname that is. Save as scriptname.bat (Make sure you drop the file types drop down list to 'All Files' versus '.txt' files. Now place the batch file in a directory that is in your path or add a path to your system and simply type your scriptname (scriptname.bat?) and your good to go. Only thing is, you'll have to either modify it when you do another script of create a new batch. Good Luck.

Reply With Quote
  #4  
Old October 30th, 2000, 06:25 AM
chrisdice4 chrisdice4 is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Aug 2000
Location: Cape Town, WP, South Africa
Posts: 39 chrisdice4 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 8
Thanks for the reply

I put the path in the autoexec.bat. And that seems to work fine I have already run several scripts.

So do I not need to include the shabang

I think this is a different problem

Reply With Quote
  #5  
Old November 10th, 2000, 09:24 AM
des des is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: May 2000
Posts: 73 des User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 9
Hi
in the control panel ODBC Data Sources - is the Data source name 'salesforecast' and is this pointing at the database you wish to query ?
this is the only think I can see that could be wrong with this - devshed seems to put a gap between the or operator | | so I'm assuming this is correct on the original script.
did you set up the file associations (eg .pl or .cgi open with perl)


I have run this on my windows machine and it works fine ( i did replace the complex select statement with a simple one on to one of my own databases)



[This message has been edited by des (edited November 10, 2000).]

Reply With Quote
  #6  
Old November 13th, 2000, 07:02 AM
chrisdice4 chrisdice4 is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Aug 2000
Location: Cape Town, WP, South Africa
Posts: 39 chrisdice4 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 8
thanks for the reply

I have been running scripts on my machine for a while now, so it is nothing to do with perl and the perl installation. This is one of those truly bizzare things that just don't work. I think my sql statement must be faulty.

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming LanguagesPerl Programming > why wont it excecute


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 4 hosted by Hostway