PEPPLER.ORG
Michael Peppler
Sybase Consulting
Menu
Home
Sybase on Linux
Install Guide for Sybase on Linux
General Sybase Resources
General Perl Resources
Freeware
Sybperl
Sybase::Simple
DBD::Sybase
BCP Tool
Bug Tracker
Mailing List Archive
Downloads Directory
FAQs
Sybase on Linux FAQ
Sybperl FAQ
Personal
Michael Peppler's resume

sybperl-l Archive

Up    Prev    Next    

From: Sofienne bahri <sofienne dot bahri at bell dot ca>
Subject: HELP:Control of A select!!!!!
Date: Mar 3 1999 3:03PM

Hello,

I"M using sybperl to develop a web database application. I send a query
to the database and i want to give back to the user a window telling him
that there is no result( in the case of no data to fecth)  how can i
handle this.

my proram looks like this

$STORED_PROC="testresult";
#$SP_ARGUMENTS="";

#Declaration des modules
use CGI;
use Sybase::CTlib;
use CGI::Carp qw(fatalsToBrowser);
$q= new CGI;

# Acees la base de donnes
$dbh = new Sybase::CTlib $DBID, $DBPASSWORD, $SERVER;
ref $dbh or Error( "Unable to login into database: $DATABASE" );
$dbh->ct_sql("use $DATABASE \n");
&requete_bd;



#------Functions------------

sub requete_bd{

#$dbh->ct_command(CS_RPC_CMD,$STORED_PROC , CS_NULLTERM,
CS_NO_RECOMPILE);

#$dbh->ct_param({name=>'@system_no',
#          datatype=>CS_CHAR_TYPE,
#          status=>CS_INPUTVALUE,
#          value=>$q->param(system_no),
#          indicator=>CS_UNUSED});
#$dbh->ct_param({name=>'@system_type',
#          datatype=>CS_CHAR_TYPE,


#         status=>CS_INPUTVALUE,
#          value=>$q->param(system_type),
#          indicator=>CS_UNUSED});

#$dbh->ct_send();
$status=$dbh->ct_execute('select * from transman where
system_no="555551" and system_type="T17"');

#Traitement des resultats de la requete

print $q->header(-TARGET=>'bas');
print $q->start_html(-title=>'Gestion des circuits',-BGCOLOR=>'white');
print "

Resultats de la recherches>
"; print ""; $ccn=0; while($dbh->ct_results($restype) == CS_SUCCEED) { if(!$dbh->ct_fetchable($restype)) { {No_Result("No_result);} # The problem is that if i enter values for which the select dont give results , normaly i have to execute No_result..But the programe continue after the if statement