Timestamps (binary) and SQL-Server/ADO-Clientside but using queries/Delphi

Posted on 2003-12-05
Last Modified: 2010-04-03
I'm using SQL-Server 2k and Delphi-ADO/ClientSide Cursors but use queries...

I populate a combobox with all the records.  

I have included a timestamp column in my table.  ( i understand its not for date/time values)

What i need is whenever I select an item from the combobox, to check if the time stamp changed from the last time it was read, and if that's true then to remove and reinsert the value inside the combobox... At the moment i'm doing it like this:

x := Combo.ItemIndex;

if Combo.Text <> Query.FieldByName('ColumnName').AsString then
      Combo.ItemIndex := x;

But i need to use TimeStamps...

Any ideas appreciated...

Question by:nick-p
1 Comment
LVL 22

Accepted Solution

mnasman earned 500 total points
ID: 9891461

  I found this function in borland newsgroups that will allow you to read the TimeStamp field as string,

  SQLTimestamp = array [0..7] of Byte;
  PSQLTimestamp = ^SQLTimestamp;

function TSToStr(const vTS: Variant): string;
    p: PSQLTimestamp;
  p := VarArrayLock(vTS);
    Result := Format('0x%.2x%.2x%.2x%.2x%.2x%.2x%.2x%.2x',
    [p^[0], p^[1], p^[2], p^[3], p^[4], p^[5], p^[6], p^[7]]);

and you can easily read the TimeStamp field and convert it string, that you compare it or doing whatever you want

procedure TForm1.Button1Click(Sender: TObject);
  V : Variant;
  V := AdoTable1['MyTimeStamp'];



Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
Virtualstringtree carsh after invalidate for while 5 80
Newbie Thread Programming 1 116
Printing problem 2 72
Delphi Form ownership 4 53
Hello everybody This Article will show you how to validate number with TEdit control, What's the TEdit control? TEdit is a standard Windows edit control on a form, it allows to user to write, read and copy/paste single line of text. Usua…
In my programming career I have only very rarely run into situations where operator overloading would be of any use in my work.  Normally those situations involved math with either overly large numbers (hundreds of thousands of digits or accuracy re…
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…
Here's a very brief overview of the methods PRTG Network Monitor ( offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…

708 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now