How to read a DateTime field from a MDB file
- From: "Bob Richardson" <bobr at whidbey dot com>
- Date: Sun, 20 Nov 2005 15:50:31 -0800
I use this type of coding to read from an MDB file.
CnnStr := Format('Provider=Microsoft.Jet.OLEDB.4.0;Data Source=%s;',
['MyMDBDataBase.mdb']);
cnn := CoConnection.Create;
cnn.Open(CnnStr, '', '', 0);
// Open Events
SQL := 'SELECT ADate,ChoiceID,EvCode,[1st],[2nd],[3rd],Name FROM
Q_ClassAssign ORDER BY ChoiceID';
rs := CoRecordset.Create;
rs.CursorLocation := adUseClient;
rs.Open(SQL, cnn, adOpenDynamic, adLockOptimistic, adCmdText);
while not rs.EOF do begin //iterate
Event := VarToStr(rs.Fields.Item['EvCode'].Value);
Date := VartoDateTime(rs.Fields.Item['ADate'].Value);
I'm getting a varient error with the last line. How can I read a DateTime
variable?
.
- Prev by Date: Re: How to make a shadowed form
- Next by Date: Delphi 7 generates Mirror-4130 virus code
- Previous by thread: drag image URL from webbrowser
- Next by thread: Delphi 7 generates Mirror-4130 virus code
- Index(es):