DBI::ODBC, Win32 Access97 and Data Types 
Author Message
 DBI::ODBC, Win32 Access97 and Data Types

I am reading fixed record info ftp'd from another machine and updating an
Access DB.  I get the following error on updates to an Access97 Table.  The
problem in in the LINENO field which Access has as an integer.  I can insert
records but updates fail.  Please help!  Is there an attribute I need to set
somewhere?

Error as follows:
[Microsoft][ODBC Microsoft Access 97 Driver] Data type mismatch in criteria
expression. (SQL-22005)(DBD: st_execute/SQLExecute err=-1) at mk.bat line 29,
<DATA> chunk 1.

Perl Code:
require 5.004;
use DBI 0.89;
open(DATA, "<phone1") || die "Can't open input file\n";
$dbh = DBI->connect('dbi:ODBC:IVR_phone1', '', '', { RaiseError => 1 });

###### Does Not Work ######
$updateh = $dbh->prepare("UPDATE OrderStatus SET SOLDTO = ?, CPYCDE = ?, STATCD
= ?, DTEPRM = ?, WONUM = ?, SHPDTE = ?, UPDTDTE = ?, UPDTTIM = ? WHERE LINENO =
? and ordnbr = ?");

###### Works ######
$updateh = $dbh->prepare("UPDATE OrderStatus SET SOLDTO = ?, CPYCDE = ?, STATCD
= ?, DTEPRM = ?, WONUM = ?, SHPDTE = ?, UPDTDTE = ?, UPDTTIM = ? WHERE LINENO =
2 and ordnbr = ?");

$inserth = $dbh->prepare("INSERT INTO OrderStatus (ORDNBR, LINENO, SOLDTO,
CPYCDE, STATCD, DTEPRM, WONUM, SHPDTE, UPDTDTE, UPDTTIM) VALUES (?, ?, ?, ?, ?,
?, ?, ?, ?, ?)");

while (<DATA>) {
 chop;


###### Tried both below... neither helps. ######
#  $field[1] = int($field[1]);
  $field[6] = int($field[6]);
#### Line 29 below ####
 $updateh->execute($field[2], $field[3], $field[4], $field[5], $field[6],
$field[7], $field[8], $field[9], $field[1], $field[0]);
 if ($updateh->rows == 0) {
  $inserth->execute($field[0], $field[1], $field[2], $field[3], $field[4],
$field[5], $field[6], $field[7], $field[8], $field[9]);
 }

Quote:
}

--
   +----------------------------------------------------------------------+
   | Jere C Julian          PO Box 100, 166 Teague Town Rd.  828-495-2304 |
   | Network Administrator  Hickory, NC 28601           Fax: 828-495-2260 |
   | LADD Upholstery Group: Barclay-Clayton Marcus-Pennsylvania House     |

   +----------------------------------------------------------------------+


Tue, 03 Oct 2000 03:00:00 GMT  
 
 [ 1 post ] 

 Relevant Pages 

1. Determining data types using Win32::ODBC

2. DBI/ODBC/Access97 error

3. Win32::ODBC - can get info from Access97 database, but can't modify

4. Win32::ODBC - can get info from Access97 database, but can't modify

5. Does ACCESS97 support Win32:ODBC::RowCount?

6. Documentation? WIN32 ODBC: Access97 - ActiveState Perl script

7. Does ACCESS97 support Win32:ODBC::RowCount?

8. Anybody against using Data::Type while Data::Types already exists on CPAN

9. ODBC, DBI Column Types Won't Bind?

10. Selecting Long data types with DBI::Oracle

11. Fwd: DBI Problem getting column data type

12. DBI Problem getting column data type

 

 
Powered by phpBB® Forum Software