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: Michael Peppler <mpeppler at peppler dot org>
Subject: Re: update question
Date: Aug 17 1999 8:52PM

Daz writes:
 > If this is not the correct list to post this to, my apologies.  Which
 > list would be better?  Im not asking for a fix(example code), just a
 > 'why' this is happening.  Even a flame would be appreciated at this
 > point (Im going crazy not being able to figure this out)

Print out the SQL command that you want to send to the server before
you send it. That should show you that you have unballanced quotes in
the command string, and where they are, and from there you should be
able to figure out what needs to be fixed in the way you build the SQL 
command for the update.

Michael

 > David
 > 
 > Daz wrote:
 > > 
 > > New to the list so please bear with me :)
 > > Also new to perl, so more 'bearing' please ;)
 > > 
 > > I am trying to write a CGI script that will call a certain row from
 > > MSSQL 6.5, save the results into one variable, take the cgi input as the
 > > second variable concatonate the two, then update the previously called
 > > row with the new information (making sure to keep the original
 > > information).  the newest problem (Ive solved most, I think) is this
 > > error:
 > > 
 > > Server message:
 > > Message number: 105, Severity 15, State 1, Line 1
 > > Server 'SERVERNAME'
 > > Message String: Unclosed quote before the character string 'how'.
 > > 
 > > Server Message:
 > > Message number: 170, Severity 15, State 1, Line 1
 > > Server 'SERVERNAME'
 > > Message String: Line 1: Incorrect syntax near 'how'.
 > > 
 > > The only text this particular column has is the word 'how'.
 > > Here is the code I am using(I know its goulish, but Ive only been using
 > > perl for a month or so)
 > > 
 > > #!/usr/bin/sybperl
 > > BEGIN {
 > >         $ENV{SYBASE} = '/home/opt/sybase';
 > > }
 > > use CGI;
 > > use Sybase::CTlib;
 > > use CGI qw (:standard);
 > > my $query= new CGI;
 > > print $query->header;
 > > print $query->start_html(-title =>"Update a Ticket",
 > >                           -bgcolor => '#FFFFFF');
 > > print qq[

Upate a ticket

]; > > print $query->startform; > > print qq[

Put in some garbage

]; > > print $query->textfield( -name => 'test' ); > > print $query->submit; > > print $query->endform; > > > > #attempt the sql part > > $dbh = new Sybase::CTlib ('username', 'password', 'DATABASE'); > > if ($query->param('test')) { > > $dbh->ct_sql("use DATABASE"); > > $test = $query->param('test'); > > > > my $cmd1 = qq[SELECT resolution FROM calls WHERE callnumber = 30000]; > > my @rows = $dbh->ct_sql($cmd1); > > my $thisrow; > > foreach $thisrow (@rows) { > > my $test2 = ${$thisrow}[0]; > > print qq[

$test2

]; > > my $test3=("$test2" . "$test"); > > $cmd = qq[UPDATE calls SET resolution = "$test3" where CALLNUMBER = > > 30000]; > > $dbh->ct_sql("use DATABASE"); > > $dbh->ct_sql($cmd); > > > > print qq[

$test3

]; > > } > > } > > print $query->end_html; > > > > Any suggestions would be most appreciated. > > David > -- Michael Peppler -||- Data Migrations Inc. mpeppler@peppler.org -||- http://www.mbay.net/~mpeppler Int. Sybase User Group -||- http://www.isug.com Sybase on Linux mailing list: ase-linux-list@isug.com