Print Thread
Unable to insert file into a BLOB field.
#7448 05/14/05 10:43 PM
Joined: Apr 2001
Posts: 38
Gauteng
R
Member
OP Offline
Member
R
Joined: Apr 2001
Posts: 38
Gauteng
BLOBS newbie, D7 and DOA V4.0.6.2

I'm getting message below message trying to insert
a file into a blob field.

"A lock, refresh or check cannot be performed without a rowid. Provide a rowid in the query or handle this action in the OnApplyRecord event"

Code:
lobQuery.SQL.Text := 'insert into projfiles(projectid_fk,filename, pfile) values(:PROJID,:FILENAME,:PFILE)';
lobQuery.SetVariable('PROJID', IntToStr(m_projectNumber));
lobQuery.SetVariable('FILENAME', odAddFiles.FileName);

//loc := TLOBLocator.Create(pvSession1, otBLOB);
loc := TLOBLocator.CreateTemporary(pvSession1, otBLOB, true);
lobQuery.DeclareVariable('PFILE', otBLOB);
lobQuery.SetComplexVariable('PFILE', loc);
try
lobQuery.Execute;
loc.LoadFromFile(odAddFiles.FileName);
loc.Free;
pvSession1.Commit;
tblProjFiles.RefreshRecord;

I'm not sure how to get rowid into insert statement.
Any ideas of what I'm doing wrong?

Thanks in advance.
Alfred

Re: Unable to insert file into a BLOB field.
#7449 05/16/05 07:35 PM
Joined: Aug 1999
Posts: 22,218
Member
Offline
Member
Joined: Aug 1999
Posts: 22,218
The dataset for which you are trying to refresh a specific record does not include a rowid. This is required to uniquely identify this record in the database. You can simply add it to the SQL statement of the dataset though. For example:

Old: select * from emp

New: select e.*, rowid from emp e


Marco Kalter
Allround Automations

Moderated by  support 

Link Copied to Clipboard
Powered by UBB.threads™ PHP Forum Software 7.7.4
(Release build 20200307)
Responsive Width:

PHP: 7.1.33 Page Time: 0.025s Queries: 13 (0.006s) Memory: 2.5001 MB (Peak: 3.0421 MB) Data Comp: Off Server Time: 2024-05-14 23:51:55 UTC
Valid HTML 5 and Valid CSS