> I would like to save pictures in a database and have successfully
> done this with DBExpress, but the same technique of using parameters
> in my queries don't seem to work.
It should. If you want help fixing your code, it would be good to
show the code that does not work.
--
Craig Stuntz [TeamB] · Vertex Systems Corp. · Columbus, OH
Delphi/InterBase Weblog : http://blogs.teamb.com/craigstuntz
IB 6 versions prior to 6.0.1.6 are pre-release and may corrupt
your DBs! Open Edition users, get 6.0.1.6 from http://mers.com
qry_RefQry.close;
qry_RefQry.UnPrepare;
qry_RefQry.SQL.Clear;
qry_RefQry.SQL.Add(
'UPDATE CAMREFTBL ' +
' SET REFIMG = :IMAGE' +
', REFTHUMB = :IMAGETHUMB' +
' WHERE CAM_ID = ' + '''' + inttostr(CamID) + '''');
qry_RefQry.Params[0].LoadfromFile(ScratchPath + 'XRefGrab.bmp', ftBlob);
qry_RefQry.Params[1].LoadFromFile(ScratchPath + 'YRefGrab.bmp', ftBlob);
qry_RefQry.Prepare;
try
qry_RefQry.ExecSQL;
except
on E: Exception do
MessageDlg('Update DB IMG Error', mtWarning, [mbOK], 0);
end;
Thanks
"Craig Stuntz [TeamB]" <craig_...@nospam.please [a.k.a. acm.org]> wrote
in message news:4899...@newsgroups.borland.com...
> Herewith the offending code.
...and the problem is?
--
Craig Stuntz [TeamB] · Vertex Systems Corp. · Columbus, OH
Delphi/InterBase Weblog : http://blogs.teamb.com/craigstuntz
Useful articles about InterBase development:
http://blogs.teamb.com/craigstuntz/category/21.aspx
"Craig Stuntz [TeamB]" <craig_...@nospam.please [a.k.a. acm.org]> wrote
in message news:4899b41a$1...@newsgroups.borland.com...
> It creates an exception error when I open the qry
<sigh>
What is the error, please?
--
Craig Stuntz [TeamB] · Vertex Systems Corp. · Columbus, OH
Delphi/InterBase Weblog : http://blogs.teamb.com/craigstuntz
How to ask questions the smart way:
http://www.catb.org/~esr/faqs/smart-questions.html
"Object reference not set to an instance of an object"
Updating values in the value fields of the table had no problems
"Craig Stuntz [TeamB]" <craig_...@nospam.please [a.k.a. acm.org]> wrote
in message news:4899d888$1...@newsgroups.borland.com...
> "Object reference not set to an instance of an object"
>
> Updating values in the value fields of the table had no problems
On which line? That's a null reference exception. When you debug
this code, which identifier is nil before the exception is raised?
--
Craig Stuntz [TeamB] · Vertex Systems Corp. · Columbus, OH
Delphi/InterBase Weblog : http://blogs.teamb.com/craigstuntz
Want to help make Delphi and InterBase better? Use QC!
http://qc.borland.com -- Vote for important issues
> I added the raise in the try statement as follows
OK, get rid of the except block and post the call stack, so I can see
what is raising the error.
--
Craig Stuntz [TeamB] · Vertex Systems Corp. · Columbus, OH
Delphi/InterBase Weblog : http://blogs.teamb.com/craigstuntz
"Craig Stuntz [TeamB]" <craig_...@nospam.please [a.k.a. acm.org]> wrote
in message news:4899edce$1...@newsgroups.borland.com...
try
qry_RefQry.ExecSQL;
except
on E: Exception do
begin
MessageDlg('Update DB IMG Error', mtWarning, [mbOK], 0);
raise; <------- THIS IS WHERE THE ERROR IS SHOWN
end;
end;
"Craig Stuntz [TeamB]" <craig_...@nospam.please [a.k.a. acm.org]> wrote
in message news:4899e8c0$1...@newsgroups.borland.com...
Borland.Vcl.Units.IBBlob::WriteBlob()
Borland.Vcl.TIBBlobStream::FinalizeBlob()
Borland.Vcl.TIBXSQLVAR::LoadFromStream()
Borland.Vcl.TIBXSQLVAR::SetAsString()
Borland.Vcl.TIBXSQLVAR::set_AsString()
Borland.Vcl.TIBQuery::SetParams()
Borland.Vcl.TIBQuery::ExecSQL()
ATCamProcess.TTestProc::AddResultToDB()
ATCamProcess.TTestProc::ExecGetRef()
ATMain.TfmATMain::SetCamRef()
ATMain.TfmATMain::sbCalibrateClick()
Borland.Vcl.TControl::Click()
Borland.Vcl.TSpeedButton::Click()
Borland.Vcl.TSpeedButton::MouseUp()
Borland.Vcl.TControl::DoMouseUp()
Borland.Vcl.TControl::WMLButtonUp()
System.Reflection.RuntimeMethodInfo::InternalInvoke()
System.Reflection.RuntimeMethodInfo::Invoke()
System.Reflection.MethodBase::Invoke()
System.Reflection.MethodInfo::Invoke()
Borland.Delphi.TObjectHelper::Dispatch()
Borland.Vcl.TControl::Dispatch()
Borland.Vcl.TControl::WndProc()
Borland.Vcl.TControl::Perform()
Borland.Vcl.TWinControl::IsControlMouseMsg()
Borland.Vcl.TWinControl::WndProc()
Borland.Vcl.TWinControl::MainWndProc()
Borland.Vcl.TObjectInstance$WinUtils::WndProc()
Borland.Vcl.TApplication::ProcessMessage()
Borland.Vcl.TApplication::HandleMessage()
Borland.Vcl.TApplication::Run()
prjAutoTech.Units.prjAutoTech::prjAutoTech()
"Craig Stuntz [TeamB]" <craig_...@nospam.please [a.k.a. acm.org]> wrote
in message news:4899ef9f$1...@newsgroups.borland.com...
> Bennie Coetzer wrote:
>
>> Sorry I don't understand - how do I I get the call stack.
>
> Ctrl+Alt+S when stopped in the debugger.
>
>> When I
>> remove the except block I just get the error and the program continues
>
> Turn on stop on exceptions in the debug options.
>
> --
> Craig Stuntz [TeamB] · Vertex Systems Corp. · Columbus, OH
> Delphi/InterBase Weblog : http://blogs.teamb.com/craigstuntz
> Sorry I don't understand - how do I I get the call stack.
Ctrl+Alt+S when stopped in the debugger.
> When I
> remove the except block I just get the error and the program continues
Turn on stop on exceptions in the debug options.
--
Craig Stuntz [TeamB] · Vertex Systems Corp. · Columbus, OH
Delphi/InterBase Weblog : http://blogs.teamb.com/craigstuntz
> Borland.Vcl.TIBXSQLVAR::SetAsString()
> Borland.Vcl.TIBXSQLVAR::set_AsString()
Well, you have a JPEG, not a string. Maybe ftBlob is treating your
file like a string, and truncating when it sees a #0. Try one of the
other types, or loading into a TMemoryStream first and then using
TParam.LoadFromStream
--
Craig Stuntz [TeamB] · Vertex Systems Corp. · Columbus, OH
Delphi/InterBase Weblog : http://blogs.teamb.com/craigstuntz
FStream.Clear;
FStream.Position:=0;
s:=FUrl;
if FParam<>'' then s:=s+'?'+Fparam;
idhttp.get(s,Fstream);
if idhttp.Response.ResponseCode=200 then
begin
FErrorCode:=0;
if idhttp.Response.ContentType='image/jpeg' then
begin
FStream.Position:=0;
if IBConnected then
begin
Fquery:=AxisCreateQuery;
try
try
with FQuery do
begin
sql.Clear;
sql.add('INSERT INTO VK_IMAGES (AXIS_IMAGE) VALUES (:MYIMAGE) ');
paramByName('MYIMAGE').LoadFromStream(FStream,ftBlob);
ExecSql;
end;
except
on e:exception do
begin
.....
Jean-Noël
"Jean-Noël Voirol" <"jnvk["@]vkvision[.]ch> wrote in message
news:489a...@newsgroups.borland.com...
It is a TMemoryStream in my case.