Do you have some date data types in your db which are used in the insert?
If yes you need to use to_date() sql function in your query.
To format the date/hours.
Ilya Sterin
-----Original Message-----
From: Mitch Clarvit
To: [EMAIL PROTECTED]
Sent: 3/12/01 11:33 AM
Subject: Connecting to An Oracle Database
I have no problem connecting to an Oracle 8.1.5 database on Netware 5.1
and
viewing the contents of the database, however, add or editing are
causing me
problems.
Here is my test code:
#!c:\perl\bin\perl.exe
use CGI;
use DBI qw(:sql_types);
$query = CGI::new();
if (($query->request_method() eq "POST") &&
($query->param("CourseID") ne '') &&
($query->param("Title") ne '') &&
($query->param("Fees") ne '') &&
($query->param("Days") ne '') &&
($query->param("Dates") ne '') &&
($query->param("Times") ne '') &&
($query->param("Location") ne '') &&
($query->param("Community") ne ''))
{
&UpdateDB;
}
else
{
print $query->header();
print $query->start_html(
-title=>'ERROR');
print "<FONT FACE='Arial' color='#FF0000'>";
print "<H2>Unable to complete insert!</H2><BR>";
print "<H3>Incomplete data was received!</H3><P>";
print "<FORM METHOD='POST' ACTION='tasks.pl'>";
print "<INPUT TYPE='hidden' NAME='Community' VALUE=$community>";
print "<INPUT TYPE='hidden' NAME='task' VALUE='Edit'>";
print "<INPUT TYPE='SUBMIT' VALUE='OK'>";
print " Try again?";
print "</FORM>";
print "</FORM>";
print "<FORM METHOD=''
ACTION='http://10.1.9.20/courses/coursedata.html'>";
print "<INPUT TYPE='SUBMIT' VALUE='OK'>";
print "<B> Choose another option?<B>";
print "</FORM>";
}
sub UpdateDB
{
$courseid=$query->param("CourseID");
$title=$query->param("Title");
$fees=$query->param("Fees");
$hours=$query->param("Hours");
$ceus=$query->param("CEUS");
$days=$query->param("Days");
$dates=$query->param("Dates");
$times=$query->param("Times");
$location=$query->param("Location");
$room=$query->param("Room");
$instructor=$query->param("Instructor");
$community = $query->param("Community");
$dsname = "ouce";
$user = "admin";
$password = "novell";
if ($room eq '')
{
$room=" ";
}
if ($instructor eq '')
{
$instructor=" ";
}
$sql = "INSERT INTO courses (CourseID, Title, Fees, Hours, CEUs,
CourseDays, CourseDates, CourseTimes, Location, Room, Instructor,
Community) VALUES (\'$courseid\', \'$title\', \'$fees\', $hours, $ceus,
\'$days\', \'$dates\', \'$times\', \'$location\', \'$room\',
\'$instructor\', \'$community\');";
DBI->trace(2,"adderror.txt");
$dbh = DBI->connect("dbi:ODBC:$dsname",$user,$password, {
RaiseError =>
1 });
$cursor = $dbh->prepare($sql);
$cursor->execute || die $dbh->errstr;
$dbh->disconnect;
print $query->header();
print $query->start_html(
-title=>'Insert Results');
print "<FONT FACE='Arial' color='#FF0000'>";
print "<H2>Insert was complete!</H2><P>";
print "<FORM METHOD='POST' ACTION='tasks.pl'>";
print "<INPUT TYPE='hidden' NAME='Community'
VALUE='$community'>";
print "<INPUT TYPE='hidden' NAME='task' VALUE='Edit'>";
print "<INPUT TYPE='SUBMIT' VALUE='OK'>";
print "<B> Add another course?</B>";
print "</FORM>";
print "<FORM METHOD=''
ACTION='http://10.1.9.20/courses/coursedata.html'>";
print "<INPUT TYPE='SUBMIT' VALUE='OK'>";
print "<FONT FACE='ARIAL' COLOR='#000000'>";
print "<B> Choose another option?</B>";
print "</FORM>";
}
I have attached the error file I have been getting...
Any help is appreciated,
Mitch Clarvit
SoftDev, Inc.
<<adderror.txt>>