Why is TADOBlobField.Savetofile only writing 8 Bytes
Question
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.
Solution 3
This problem was directly caused by my having not applied the Delphi 7 Update 1.
This is a known bug in the shipped version of Delphi 7.
OTHER TIPS
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
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