| View previous topic :: View next topic |
| Author |
Message |
Jodok Schaeffler Guest
|
Posted: Sun Aug 15, 2004 4:46 am Post subject: How to read a DateTime value from DataSet? |
|
|
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
|
Posted: Tue Aug 17, 2004 10:44 am Post subject: Re: How to read a DateTime value from DataSet? |
|
|
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
|
Posted: Tue Aug 17, 2004 12:29 pm Post subject: Re: How to read a DateTime value from DataSet? |
|
|
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 |
|
 |
|