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
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
LVL 22

Accepted Solution

Mohammed Nasman 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

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

The uses clause is one of those things that just tends to grow and grow. Most of the time this is in the main form, as it's from this form that all others are called. If you have a big application (including many forms), the uses clause in the in…
Objective: - This article will help user in how to convert their numeric value become words. How to use 1. You can copy this code in your Unit as function 2. than you can perform your function by type this code The Code   (CODE) The Im…
There's a multitude of different network monitoring solutions out there, and you're probably wondering what makes NetCrunch so special. It's completely agentless, but does let you create an agent, if you desire. It offers powerful scalability …
Sometimes it takes a new vantage point, apart from our everyday security practices, to truly see our Active Directory (AD) vulnerabilities. We get used to implementing the same techniques and checking the same areas for a breach. This pattern can re…
Suggested Courses
Course of the Month6 days, 3 hours left to enroll

627 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