Board index » delphi » Delphi 4.03 prof, SQL7, BDE 5.01, TParam.LoadFromStream problem

Delphi 4.03 prof, SQL7, BDE 5.01, TParam.LoadFromStream problem

Hi all
I have a problem with assigning a stream object to a stored proc parameter
usinf TParam.LoadFromStream. No error message is generated, but the UPDATE
stored proc doesn't get executed. If I remove the parameter assignment
(don't try to give it a value) the stored proc runs successfully (it updates
a text field).

Does anyone know why this might be and if there is a way round? I have also
tried TParam.LoadFromFile, but that doesn't work either.

Thanks in advance.

Cheers
John Hair

 

Re:Delphi 4.03 prof, SQL7, BDE 5.01, TParam.LoadFromStream problem


What is your entire code to load the blob and execute the proc?

Blaine Whittle

Quote
John Hair <jo...@kinetic-solutions.co.uk> wrote in message

news:7omreg$7hu17@forums.borland.com...
Quote
> Hi all
> I have a problem with assigning a stream object to a stored proc parameter
> usinf TParam.LoadFromStream. No error message is generated, but the UPDATE
> stored proc doesn't get executed. If I remove the parameter assignment
> (don't try to give it a value) the stored proc runs successfully (it
updates
> a text field).

> Does anyone know why this might be and if there is a way round? I have
also
> tried TParam.LoadFromFile, but that doesn't work either.

> Thanks in advance.

> Cheers
> John Hair

Re:Delphi 4.03 prof, SQL7, BDE 5.01, TParam.LoadFromStream problem


Quote
>What is your entire code to load the blob and execute the proc?

OK. The stored proc is as follows;

CREATE PROCEDURE SetWordTemplates
 @WordTemplateID int,
 @Description  char(40),
 @Template  image
 AS

UPDATE
 WordTemplates
SET
 Description  = @Description,
 Template  = @Template
WHERE
 WordTemplateID = @WordTemplateID

The code is as follows;

    spSet.ParamByName('@WordTemplateID').AsInteger := 3;
    spSet.ParamByName('@Description').AsString     := 'New3';

    fsFile := TFileStream.Create('c:\test.bmp', fmOpenRead);
    fsFile.Seek(soFromBeginning, 0);

    spSet.ParamByName('@Template').LoadFromStream(fsFile, ftBlob);

    spSet.ExecProc;

    fsFile.Free;

Thanks for any help.

Cheers
John Hair

Re:Delphi 4.03 prof, SQL7, BDE 5.01, TParam.LoadFromStream problem


Hi all
I have a problem with assigning a stream object to a stored proc parameter
usinf TParam.LoadFromStream. No error message is generated, but the UPDATE
stored proc doesn't get executed. If I remove the parameter assignment
(don't try to give it a value) the stored proc runs successfully (it updates
a text field).

Does anyone know why this might be and if there is a way round? I have also
tried TParam.LoadFromFile, but that doesn't work either.

Here is the stored proc;
CREATE PROCEDURE SetWordTemplates
@WordTemplateID int,
@Description  char(40),
@Template  image
AS

UPDATE
WordTemplates
SET
Description  = @Description,
Template  = @Template
WHERE
WordTemplateID = @WordTemplateID

Here is the code that my Delphi app runs;
    spSet.ParamByName('@WordTemplateID').AsInteger := 3;
    spSet.ParamByName('@Description').AsString     := 'New3';

    fsFile := TFileStream.Create('c:\test.bmp', fmOpenRead);
    fsFile.Seek(soFromBeginning, 0);

    spSet.ParamByName('@Template').LoadFromStream(fsFile, ftBlob);

    spSet.ExecProc;

    fsFile.Free;

Thanks in advance.

Cheers
John Hair

Re:Delphi 4.03 prof, SQL7, BDE 5.01, TParam.LoadFromStream problem


Hi all
I have a problem with assigning a stream object to a stored proc parameter
usinf TParam.LoadFromStream. No error message is generated, but the UPDATE
stored proc doesn't get executed. If I remove the parameter assignment
(don't try to give it a value) the stored proc runs successfully (it updates
a text field).

Does anyone know why this might be and if there is a way round? I have also
tried TParam.LoadFromFile, but that doesn't work either.

Here is the stored proc;
CREATE PROCEDURE SetWordTemplates
@WordTemplateID int,
@Description  char(40),
@Template  image
AS

UPDATE
WordTemplates
SET
Description  = @Description,
Template  = @Template
WHERE
WordTemplateID = @WordTemplateID

Here is the code that my Delphi app runs;
    spSet.ParamByName('@WordTemplateID').AsInteger := 3;
    spSet.ParamByName('@Description').AsString     := 'New3';

    fsFile := TFileStream.Create('c:\test.bmp', fmOpenRead);
    fsFile.Seek(soFromBeginning, 0);

    spSet.ParamByName('@Template').LoadFromStream(fsFile, ftBlob);

    spSet.ExecProc;

    fsFile.Free;

Thanks in advance.

Cheers
John Hair

Other Threads