 |
BorlandTalk.com Borland discussion newsgroups
|
| View previous topic :: View next topic |
| Author |
Message |
Andrew Lockwood Guest
|
Posted: Mon Feb 12, 2007 7:13 pm Post subject: Access violation accessing value of timestamp field |
|
|
Can anyone explain to me why, if I try to evaluate the value of an interbase
timestamp field from within the IDE by placing the cursor over the code, I
get an Access Violation? For example:-
MyQuery.FieldByName(TimestampField).Value
I appreciate that if I use AsDateTime instead of Value, I can avoid this
problem, but I am writing a program where I need to use a variant, and I
find this very frustrating / perplexing.
I do not know if it is related, but on one of my computers, I now have the
additional problem that the code has now started crashing on this line of
code with an error EVA-1232 - some problem with the bordbk70.dll file. |
|
| Back to top |
|
 |
Wayne Niddery [TeamB] Guest
|
Posted: Mon Feb 12, 2007 9:41 pm Post subject: Re: Access violation accessing value of timestamp field |
|
|
Andrew Lockwood wrote:
| Quote: |
I appreciate that if I use AsDateTime instead of Value, I can avoid
this problem, but I am writing a program where I need to use a
variant, and I find this very frustrating / perplexing.
|
In all seriousness, *why* must you use the variant property? Variants cannot
properly distinguish between a TDateTime type and its root Double type and
is a common source of problems for exactly this reason. You should do
*anything* you can to avoid variants in general, but especially in the case
of dates and times.
--
Wayne Niddery - Winwright, Inc (www.winwright.ca)
"Bandwagons are like streetcars, there'll be another along in a few
minutes." |
|
| Back to top |
|
 |
Andrew Lockwood Guest
|
Posted: Tue Feb 13, 2007 12:54 am Post subject: Re: Access violation accessing value of timestamp field |
|
|
I am reading values from my dataset into an array, and I need the array to
be flexible so that it can hold different types of data.
I could easily recode it to read
MyArray[Count].Value := IBXDataset.FieldByName(TimestampField).AsDateTime
But would this make any difference if I am still storing the value as a
variant?
Andrew Lockwood
"Wayne Niddery [TeamB]" <wniddery (AT) chaffaci (DOT) on.ca> wrote in message
news:45d08ab9 (AT) newsgroups (DOT) borland.com...
| Quote: | Andrew Lockwood wrote:
I appreciate that if I use AsDateTime instead of Value, I can avoid
this problem, but I am writing a program where I need to use a
variant, and I find this very frustrating / perplexing.
In all seriousness, *why* must you use the variant property? Variants
cannot properly distinguish between a TDateTime type and its root Double
type and is a common source of problems for exactly this reason. You
should do *anything* you can to avoid variants in general, but especially
in the case of dates and times.
--
Wayne Niddery - Winwright, Inc (www.winwright.ca)
"Bandwagons are like streetcars, there'll be another along in a few
minutes."
|
|
|
| Back to top |
|
 |
Wayne Niddery [TeamB] Guest
|
Posted: Tue Feb 13, 2007 4:10 am Post subject: Re: Access violation accessing value of timestamp field |
|
|
Andrew Lockwood wrote:
| Quote: | I am reading values from my dataset into an array, and I need the
array to be flexible so that it can hold different types of data.
I could easily recode it to read
MyArray[Count].Value :=
IBXDataset.FieldByName(TimestampField).AsDateTime
But would this make any difference if I am still storing the value as
a variant?
|
Going in this direction I'm not sure if there is a problem (other than
variants are slower). Going back into the database field object though is
where I often see problems - i.e. converting from a variant to a datetime.
If you consistently use the AsXXX properties in the TFields, that might be
enough to avoid problems even though they are going to/coming from variants,
but I don't know that for sure - I had enough problems with variants very
early on that I've avoided them completely since then.
--
Wayne Niddery - Winwright, Inc (www.winwright.ca)
"Democracy, without the guarantee of liberty, is merely a method of
selecting tyrants." - Alan Nitikman |
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|