0

At the point of posting a record to a database table I get the following error:

Could not parse sql timestamp string.

At the click of a button my code does the following:

qry1.Open;
qry1.Insert;
qry1.FieldByName('files_uploaded').asdatetime := qry2.FieldByName('files_uploaded').asdatetime;
qry1.Post;
qry1.Close;

The datatype for the field in the database table is timestamp.

Example of the data in the field : 2014-04-23T14:48:40.816+01:00.

I'm not entirely sure what I'm doing wrong or unless its something to do with the field data.

Any help would be appreciated.

Roman Marusyk
  • 23,328
  • 24
  • 73
  • 116
Sharpie
  • 373
  • 2
  • 15
  • 34
  • 1
    A timestamp column does not contain a date/time. It is a numeric value incremented by Sybase automatically each time a row is updated. – Keith Miller Aug 03 '15 at 13:58

2 Answers2

1

Please try this code:

qry1.Open;
qry1.Insert;
qry1.FieldByName('files_uploaded').AsSQLTimeStamp :=qry2.FieldByName('files_uploaded').AsSQLTimeStamp;
qry1.Post;
qry1.Close;
Roman Marusyk
  • 23,328
  • 24
  • 73
  • 116
0

Try setting ".Value" instead of defining the Data Type. When you use .Value the dataset will convert everything that is necessary.

qry1.Open;
qry1.Insert;
qry1.FieldByName('files_uploaded').Value :=qry2.FieldByName('files_uploaded').Value;
qry1.Post;
qry1.Close;
Leo Melo
  • 196
  • 5