What's the data type for "long (64-bit integer)"?


C

Cat

I'm writing a .NET application. I want to save a "long" value (64-bit
integer) to a Access MDB file, but an overflow occurred. I found out
that it was due to the field type I set in the Access. I set it to
"Number/Long Integer" thinking that's "long", but it turned out to be
a 32-bit integer. Other choices are double, single, decimal,
Replication ID, AutoNumber, byte. None of them seem to be 64-bit
integer. What should I do? What's the Access type for "long"?
 
Ad

Advertisements

C

Cat

Access doesn't have a 64 bit integer data type.

Ah...This is kind of awkward, since I think many programs use 'long'
type values.
As a workaround, I saved it as a decimal and cast it to long when
reading from MDB.
Is this the right way? How do other people handle this problem?
 
Ad

Advertisements

J

Jamie Collins

I'm writing a .NET application. I want to save a "long" value (64-bit
integer) to a Access MDB file, but an overflow occurred. I found out
that it was due to the field type I set in the Access. I set it to
"Number/Long Integer" thinking that's "long", but it turned out to be
a 32-bit integer. Other choices are double, single,decimal,
Replication ID, AutoNumber, byte. None of them seem to be 64-bit
integer. What should I do? What's the Access type for "long"?

I too would use DECIMAL because that is what Jet natively considers
such values to be e.g.

SELECT TYPENAME(9223372036854775807)

returns 'Decimal'.

Note that Jet's 'cast to DECIMAL' function CDEC() is broken and this
can cause problems e.g.

SELECT TYPENAME(2147483647 + 1)

returns 'Double', which is a problem because Jet's 8 byte FLOAT is
only approximate to 15 significant figures.

Jamie

--
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top