Search code examples
delphidelphi-xe2sybase-asa

Could not parse sql timestamp string error message


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.


Solution

  • 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;