Help: Connect Perl and MSAccess database

From: Ranjith eyacheruvatt (ranjithepost_at_yahoo.co.in)
Date: 05/26/04


Date: Wed, 26 May 2004 11:43:19 +0100 (BST)
To: beginners@perl.org

Hello
Now I started in perl, I could do simple programs such as string manipulations, but i could not connect to
MSAccess database located at my server. This is the code i used.
file://=========ADO code start here========
print "Content-Type: text/html\n\n";
use "win32::OLE"
Set conn = Server.CreateObject("ADODB.Connection")
Set RS = Server.CreateObject("ADODB.RecordSet")
#TEST is the DNS
 conn.Open "DSN=TEST"
 RS.Open "SELECT * FROM WsCoupon", conn, adOpenDynamic, adLockPessimestic, adCMDText
 WHILE NOT RS.EOF
   Response.write "<br>"&RS("OrderID")
   RS.MoveNext
  WEND
  RS.Close
  conn.Close
file://==========ADO end here=====
file://===above code shows error as follows:
CGI Error
The specified CGI application misbehaved by not returning a complete set of HTTP headers. The headers it did return are:
syntax error at D:\Inetpub\wwwroot\ECouponInfoPages\HelloPerl.pl line 3, next token ???
Execution of D:\Inetpub\wwwroot\ECouponInfoPages\HelloPerl.pl aborted due to compilation errors.
#======ADO error ends here
i also tried ODBC code as follows,
#=======ODBC code here==========
print "Content-Type: text/html\n\n";
 use DBI;
 $dbh = dbi->connect('dbi:ODBC:eCoupon');
 $sqlstatement="SELECT OrderID FROM WsCoupon";
 $sth = $dbh->prepare($sqlstatement);
 $sth->execute || die "Could not execute SQL statement ... maybe invalid?";
 while (@row=$sth->fetchrow_array)
 {
  print "@row\n"
 }
#==ODBC code ends here=======
This also make errors [on:- use DBI; statement]
#=========================
If you can help me either of this code please send me that code or refference.
 
Anticipatting an early reply.
Thanks in advance
Ranjith
email: ranjithepost@yahoo.co.in

Yahoo! India Matrimony: Find your partner online.



Relevant Pages

  • Re: Windows Forms through IE
    ... CGI Error ... HTTP headers. ... > Sijin Joseph ... > Ron L wrote: ...
    (microsoft.public.dotnet.framework.windowsforms)
  • Re: response.redirect "bla.php"
    ... "dalyjason" escreveu na mensagem ... > CGI ERROR ... > set of HTTP headers. ...
    (microsoft.public.inetserver.asp.general)
  • Using exec function to get a .exe return status gives CGI Error
    ... be something related with the configuration. ... CGI Error: The script can .. ... the HTTP headers are needed only if the executable prints ...
    (comp.lang.php)
  • Re: Passing an cgi variable to a sql query
    ... > CGI Error ... > The specified CGI application misbehaved by not returning a complete set ... > of HTTP headers. ... A good discipline is to make a small test program to show the error. ...
    (comp.lang.perl.misc)
  • CGI Error
    ... CGI Error ... The specified CGI application misbehaved by not returning a complete set of ... HTTP headers. ... anonymous access is given on NTF side on the folder. ...
    (microsoft.public.inetserver.iis.security)