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 

How to read a DateTime value from DataSet?

 
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> Delphi Databases (ADO)
View previous topic :: View next topic  
Author Message
Jodok Schaeffler
Guest





PostPosted: Sun Aug 15, 2004 4:46 am    Post subject: How to read a DateTime value from DataSet? Reply with quote



Hello,

I'm using D8 and would like to read a DateTime value from a DataSet.
The DataSet gets filled with a DataAdapter from a MySql database.

How can I tell D8 that this value should be read as DateTime value?
There is nothing like the ToString function for a DateTime value.

this is used to read a string out of the DataSet:
j:integer;
MyString : String;
MyString :=
DataSet1.tables['MyTable'].Rows[j].Item['MyStringColumn'].ToString;

How do I read a DateTime value out of the DataSet?
MyDateTime : datetime;
MyDateTime:=
DataSet1.tables['MyTable'].Rows[j].Item['MyDateTimeColumn'].ToDateTime;

=> does not work. There is no such funktion as ToDateTime.

?

With best regards

Jodok Schaeffler


Back to top
Bernhard Mayer
Guest





PostPosted: Tue Aug 17, 2004 10:44 am    Post subject: Re: How to read a DateTime value from DataSet? Reply with quote



read the help. the function to get a value as a different type are the as...
functions.
AsString, AsInteger, AsDateTime, ....


"Jodok Schaeffler" <schaeffler (AT) acm (DOT) org> schrieb im Newsbeitrag
news:411eeaa4 (AT) newsgroups (DOT) borland.com...
Quote:
Hello,

I'm using D8 and would like to read a DateTime value from a DataSet.
The DataSet gets filled with a DataAdapter from a MySql database.

How can I tell D8 that this value should be read as DateTime value?
There is nothing like the ToString function for a DateTime value.

this is used to read a string out of the DataSet:
j:integer;
MyString : String;
MyString :=
DataSet1.tables['MyTable'].Rows[j].Item['MyStringColumn'].ToString;

How do I read a DateTime value out of the DataSet?
MyDateTime : datetime;
MyDateTime:=
DataSet1.tables['MyTable'].Rows[j].Item['MyDateTimeColumn'].ToDateTime;

=> does not work. There is no such funktion as ToDateTime.

?

With best regards

Jodok Schaeffler





Back to top
Viatcheslav V. Vassiliev
Guest





PostPosted: Tue Aug 17, 2004 12:29 pm    Post subject: Re: How to read a DateTime value from DataSet? Reply with quote



You may just cast it to type you need:

dt := DateTime(DataSet1.tables['MyTable'].Rows[j].Item['MyStringColumn']);

//------------------------------------------
Regards,
Vassiliev V. V.
http://www.managed-vcl.com - using .Net objects in Delphi for Win32 +
ADO.Net
http://www.oledbdirect.com - The fastest way to access MS SQL Server,
MS Jet (Access) and Interbase (through OLEDB)

"Jodok Schaeffler" <schaeffler (AT) acm (DOT) org> сообщил/сообщила в новостях
следующее: news:411eeaa4 (AT) newsgroups (DOT) borland.com...
Quote:
Hello,

I'm using D8 and would like to read a DateTime value from a DataSet.
The DataSet gets filled with a DataAdapter from a MySql database.

How can I tell D8 that this value should be read as DateTime value?
There is nothing like the ToString function for a DateTime value.

this is used to read a string out of the DataSet:
j:integer;
MyString : String;
MyString :=
DataSet1.tables['MyTable'].Rows[j].Item['MyStringColumn'].ToString;

How do I read a DateTime value out of the DataSet?
MyDateTime : datetime;
MyDateTime:=
DataSet1.tables['MyTable'].Rows[j].Item['MyDateTimeColumn'].ToDateTime;

=> does not work. There is no such funktion as ToDateTime.

?

With best regards

Jodok Schaeffler





Back to top
Display posts from previous:   
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> Delphi Databases (ADO) 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.