BorlandTalk.com Forum Index BorlandTalk.com
Borland discussion newsgroups
 
Archives   FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Access violation accessing value of timestamp field

 
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> Delphi Databases (InterBase Express)
View previous topic :: View next topic  
Author Message
Andrew Lockwood
Guest





PostPosted: Mon Feb 12, 2007 7:13 pm    Post subject: Access violation accessing value of timestamp field Reply with quote



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





PostPosted: Mon Feb 12, 2007 9:41 pm    Post subject: Re: Access violation accessing value of timestamp field Reply with quote



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





PostPosted: Tue Feb 13, 2007 12:54 am    Post subject: Re: Access violation accessing value of timestamp field Reply with 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?


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





PostPosted: Tue Feb 13, 2007 4:10 am    Post subject: Re: Access violation accessing value of timestamp field Reply with quote

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
Display posts from previous:   
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> Delphi Databases (InterBase Express) All times are GMT
Page 1 of 1

 
Jump to:  
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


Powered by phpBB © 2001, 2006 phpBB Group
SEO toolkit © 2004-2006 webmedic.