🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.cppbuilder.database.ado
Article #1309

How do you convert MS SQL datetime field with ADODataSet in BCB 6 Pro

#1309
From: Keith Howell
Date: Wed, 11 Aug 2004 03:41
26 lines
1898 bytes
I am querying a table from a MS SQL 2000 server that has a date field
that is of type datetime by using a TADODataSet object.  I have no
problems retrieving data, but when it comes time to access the
datetime field from the database, I cannot retrieve anything except
the MM/DD/YYYY.  There is a time portion associated with the field in
the database but I have no idea how to make Builder grab the entire
date/time rather than just the date.  I've tried reading the field
into String and TDateTime variables, but I still get the same result.

Here's a snippet of code...

TADODataSet *adoobject;
...
String cprime_date = adoobject->FieldByName("starttime")->AsString;

--- or ---

TDateTime tdt = adoobject->FieldByName("starttime")->AsDateTime;
String zzz = tdt.DateTimeString();


Both FieldByName calls end up returning the same exact date with the
time missing.  How can I retrieve the entire date/time using the
TADODataSet object?  I can't believe something so straighforward could
be so mind-numbing.  Thanks for any help anyone might be able to
provide!!!
Technical Details
Message-ID: <e2066678.0408101941.de602f5@posting.google.com>
Path: arc1-ca.pugleaf.net!g2news1.google.com!postnews2.google.com!not-for-mail

Show Full Headers
Complete Article Headers
X-Google-Thread: 10698b,5f2b47bcf6bfbefc,start
X-Google-Attributes: gid10698b,public
X-Google-Language: ENGLISH,ASCII-7-bit
Path: arc1-ca.pugleaf.net!g2news1.google.com!postnews2.google.com!not-for-mail
From: keithh@flowcal.com (Keith Howell)
Newsgroups: borland.public.cppbuilder.database.ado
Subject: How do you convert MS SQL datetime field with ADODataSet in BCB 6 Pro
Date: 10 Aug 2004 20:41:25 -0700
Organization: http://groups.google.com
Lines: 26
Message-ID: <e2066678.0408101941.de602f5@posting.google.com>
NNTP-Posting-Host: 207.218.212.249
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 8bit
X-Trace: posting.google.com 1092195685 31627 127.0.0.1 (11 Aug 2004 03:41:25 GMT)
X-Complaints-To: groups-abuse@google.com
NNTP-Posting-Date: Wed, 11 Aug 2004 03:41:25 +0000 (UTC)