|
|
sybperl-l Archive
Up Prev Next
From: "J dot H dot P" <jong at ebi dot ac dot uk>
Subject: How to insert a row?
Date: Jul 23 1999 4:01PM
Hi ,
I try to insert some data to a table
useing DBI:Sybase.
However, it does not seem work even though
I tried many different combinations.
I am a beginner.
I am sure my server is running fine
now.
Can anybody tell me what is wrong?
Thanks,
Jong
==============================================================================================
$sth=$dbh->prepare(qq{ CREATE TABLE TEST (Title text, Function text,
Version text, Content text,
Contact text) }) || warn "\n Failed
to prepare ";
$rv=$sth->execute || warn "\n CREATE did not work ";
$sth=$dbh->prepare(qq{ INSERT INTO TEST VALUES ($sub_title, $sub_funcion,
$sub_version, $sub_content, $sub_contact); });
$rv=$sth->execute;
$sth=$dbh->prepare( qq{ SELECT * FROM TEST; } ) || die "\nCan\'t prepare
statement: $DBI::errstr";
$rv=$sth->execute;
while(@row = $sth->fetchrow_array) {
@row=$sth->fetchrow_array;
print " ------- $row[1] ------------ ";
print "0 $row[0]\t 1 $row[1]\t 2 $row[2]\n";
}
===========================================================
-- Jong Park : a Biology student -- Tel work: +44 1223 49-4613
BioPerl Conference with ISMB 99 in Heidelberg ==>
http://bio.perl.org/bioperl-99/
|