|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
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
|
|||
|
|||
|
Hi there
My script wont excecute is there anybody got any ideas #c erlbinperl.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; |
|
#2
|
|||
|
|||
|
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. |
|
#3
|
|||
|
|||
|
I concur with christuckers reply. In case you aren't familiar with writing the batch file. Open notepad and simply type the following: c
erlbinperl.exe scriptnameYour 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. |
|
#4
|
|||
|
|||
|
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 |
|
#5
|
|||
|
|||
|
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).] |
|
#6
|
|||
|
|||
|
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. |
![]() |
| Viewing: Dev Shed Forums > Programming Languages > Perl Programming > why wont it excecute |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|