473,404 Members | 2,137 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,404 software developers and data experts.

ADODB Currency type broken in Python win32?

It looks to me like the handling of the currency type in an ADODB
connecction from Python is broken. Currency data in an Access database is
stored as a 64-bit integer, scaled by 10000. In an ADODB recordset, this
is returned as a 2-tuple, where the second element is the currency value,
but the value is stored as a normal integer, not a lont integer. Thus, it
fails for values greater than about $214,700 (2**32 / 10**4).

Here is an example:

import win32com.client
conn = win32com.client.Dispatch("ADODB.Connection")
conn.Open("DRIVER={Microsoft Access Driver (*.mdb)};DBQ=anydatabase.mdb")
cmd = win32com.client.Dispatch("ADODB.Command")
cmd.ActiveConnection = conn
cmd.CommandText = "SELECT CCur(250000) AS myMoney;"
rs = cmd.Execute()[0]
for f in rs.Fields:
print f.Name
print f.Type
print f.Value

One would expect

myMoney
6
(0, 2500000000L)

Instead, we get:

myMoney
6
(0, -1794967296)

The value has wrapped at 2**31.
--
- Tim Roberts, ti**@probo.com
Providenza & Boekelheide, Inc.
Jul 19 '05 #1
0 1239

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

28
by: Grant Edwards | last post by:
I finally figured out why one of my apps sometimes fails under Win32 when it always works fine under Linux: Under Win32, the pickle module only works with a subset of floating point values. In...
2
by: magister | last post by:
Hello, Is there a way I can validate the input on a textbox for currency including all currency symbols.. At the moment I have it only for the current culture info, but most banks use several...
8
by: Ben | last post by:
Hi! I already sent this to the ACCESS newsgroup. But since I do not know really which side is really causing the problem, I have decided to send this inquiry to this newsgroup also, if I may....
7
by: Bryan | last post by:
Hi , I am using ADO (ADODB) with access database. Not sure what I am doing wrong.here. Can anyone please help me? string mdbFile = System.IO.Directory.GetCurrentDirectory() +" \\bTrack.mdb;"...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.