tags:

views:

446

answers:

2

I have a working application that I have revisited recently.

I store a file in a text field in a MSSQL database. I read it into an ADOTable and as a TBlobfield call Savetofile to write it to a file on disk. This has always worked. However now it is simply saving a 8 byte file rather than the correct file.

I have a vague memory of this happening before and was wondering if anyone has come across it and knows the solution? I am using Delphi 7.

+1  A: 

Several years ago (older versions of ado), ther was a problem, if the blob field(s) wasn't the last field in the query. I don't know it that still is true

BennyBechDk
+3  A: 

Has anything changed in the database (server/version upgrade)? Client machine (XP? Vista?)? What is being saved when you call the SaveToFile method (maybe the file is only 8 bytes)? Could the field be empty/null?

I would recommend not using table based components (TTable, TADOTable, etc) against a set based RDBMS (MSSQL, Oracle, etc), use TADODataSet and make sure you have all the D7/ADO patches applied.

Good luck

KevinRF