I am now trying to ENTER a pic into the databaser as I am not sure I had one in there correctly to test the readout methods. I have tried the following:
if PicDialog.Execute then
begin
// first make a new record in the db without the pic in it
frmMain.qData.SQL.Clear;
frmMain.qData.SQL.Add('INS
ERT INTO ASSETFACET ');
frmMain.qData.SQL.Add(' (AFType, AFFacetID, AFAssetID, AFSeq)');
frmMain.qData.SQL.Add(' VALUES (');
frmMain.qData.SQL.Add(intt
ostr(TYPE_
PIC) + ',');
frmMain.qData.SQL.Add(intt
ostr(frmMa
in.fiCurrF
acet) + ',');
frmMain.qData.SQL.Add(intt
ostr(frmMa
in.fiCurrA
sset) + ',');
frmMain.qData.SQL.Add(intt
ostr(frmMa
in.fiTotal
FASeq + 1) + ')');
frmMain.qData.ExecSQL;
// then somehow load the pic into it
frmMain.tblAF.Open;
frmMain.tblAF.Edit;
TBlobField(frmMain.tblAF.F
ieldByName
('AFPic'))
.LoadFromF
ile(PicDia
log.FileNa
me);
frmMain.tblAF.Post;
frmMain.tblAF.Close;
tblAF is a TADOTable.
When the code gets to the frmMain.tblAF.Open line, it says "EvariantTypeError: ... Could not convert variant of type (Null) into type (String)". I have no idea what this means. It has been a while since I have used tables; and I only used the basic BDE methods, which, while apparently too memory intentive to use today, at least had the advantage of working pretty much straight out of the box, whereas these ADO equivalents need to come with a box of screwdrivers, 'cos it seems to me you constantly have to tinker with them to get them to work in the first place.
Incidentally, I would prefer to do away entirely with the TADOTable and I would if I could get SQL code to insert the pic into the DB directly. So I have asked that question separately in: