OK, I got it to work.  I appreciate the help.

Another question.

The reason I switched to DBI is because I was having a problem with getting
a WRITE CONFLICT error when users try to manually edit the records (that
were inserted by the script) while in MS ACCESS.  The records can be edited
by an UPDATE QUERY in Access but not manually edited in the table.  The back
end tables are SQL and the front end is a MS Access database.  It is like
the record is still open and was not closed by the script.  The WorkRequest
table can be edited but the FILE_DETAILS table cannot.

I have the same problem using DBI.  I was hoping it was just a quirk with
Win32::ODBC.

Any ideas are appreciated!

Thanks!
Kristi


Here is the script:

#! perl -w
use DBI;
use DMC::Timestamp;

$lstamp = LONGSTAMP();
$sstamp = SHORTSTAMP();

$DSN = "DBI:ODBC:database";
$user = "userid";
$pw = "pass";
$dbh = DBI->connect($DSN,$user,$pw,{RaiseError => 1}) || die "Cannot
connect: $DBI::errstr\n" unless $dbh;


$sql = ("INSERT INTO WorkRequest(DCA, Billing_Status, Create_Date, AccRep,
CC, BU_Group, ClientID, Customer_Name, ProjectID, WRType, IntorData,
ShipDate, Ext,Completed)  VALUES('NONE' , 'NONE', '$lstamp', 'userid',
'userid', 'SERVICES', '5', 'TEST', 'KKKY', 'Outbound', 'Dataset', '$sstamp',
'20000', 'JOB IN QUE' )");              

$dbh->do ($sql);


$sql = ("SELECT [EMAIL PROTECTED]@IDENTITY AS 'Identity'" );
$sth = $dbh->prepare ($sql); $sth->execute();

$hash1 = $sth->fetchrow_hashref()
$wrnum = $hash1->{'Identity'};

$sql = ("INSERT INTO File_Details(WRID, FileName, MediaType,
Conversion_Type, PCOMMENTS, Output_Filename, Record_Count, Record_Length,
Additional_Info, Status, Layout, TapeFormat, OutFtpUserID, OutFTPPsswrd,
OutFTPServer, Email) VALUES('$wrnum', 'SEE ADDITIONAL INFORMATION ',
'CDROM', 'LOAD FILE AS IS', 'Auto Create WR for CD', 'SAME', '0', '0',
'INFO' , 'JOB IN QUE', 'none', 'na', 'undefined', 'undefined', 'undefined',
'undefined' )");                            
$dbh->do ($sql);



$dbh->disconnect();

exit 0;






-----Original Message-----
From: Hardy Merrill [mailto:[EMAIL PROTECTED]
Sent: Monday, September 29, 2003 10:55 AM
To: Sterin, Ilya (I.)
Cc: 'Goodman Kristi - kgoodm'; '[EMAIL PROTECTED]'
Subject: Re: New to DBI


Sterin, Ilya (I.) [EMAIL PROTECTED] wrote:
> my $sth = $dbh->prepare("select .....");
> $sth->execute();
> 
> my $data = $sth->fetchrow_hashref();
> 
> my $list = $data->{'Col1'};

Just personal preference for naming variables what they
contain, but it might help Krisi understand what's going
on and how this works:

  my $row_hashref = $sth->fetchrow_hashref();
  $list = $row_hashref->{'ListID'}; #ListID is the column name
  $proj = $row_hashref->{'ProjID'}; #ProjID is the column name

HTH.
-- 
Hardy Merrill
Red Hat, Inc.

> 
> Ilya
> 
> -----Original Message-----
> From: Goodman Kristi - kgoodm [mailto:[EMAIL PROTECTED]
> Sent: Monday, September 29, 2003 11:19 AM
> To: '[EMAIL PROTECTED]'
> Subject: New to DBI
> 
> 
> Hello!
> 
> I am a Win32::ODBC user and I am trying to convert to DBI.  However, I am
> having trouble trying to figure out how to do one thing.  How can you
return
> a hash where you can assign the values returned to a variable.
> 
> 
> This is the code I have from using the WIN32::ODBC module and I would like
> to do the same thing using DBI.
> 
> $db1->Sql("SELECT * FROM WORKREQUEST WHERE (WRID = '$wrnum' )" );
> $db1->FetchRow();
> %db1hash = $db1->DataHash();
> $list         = $db1hash{'ListID'};  #ListID is the column name
> $proj         = $db1hash{'ProjID'}; #ProjID is the column name
> ect...
> 
> 
> 
> Can anyone help?  Please let me know if this is not a clear explanation on
> what I am trying to do.
> 
> Thanks!
> Kristi
> 
> 
> 
> 
> 
> 
> 
> 
> Kristi Goodman 
> Technical Support Specialist 
> AECMS, O/ITS
> Acxiom Corporation , Conway Campus







**********************************************************************
The information contained in this communication is
confidential, is intended only for the use of the recipient
named above, and may be legally privileged.
If the reader of this message is not the intended
recipient, you are hereby notified that any dissemination, 
distribution, or copying of this communication is strictly
prohibited.
If you have received this communication in error,
please re-send this communication to the sender and
delete the original message or any copy of it from your
computer system. Thank You.

Reply via email to