mece
asked on
Save file to MS SQL Database
hi to all,
i want to save a file to a ms sql server database table
first i create a row
EkFile -> varbinary -> 50
then at delphi i wrote these lines
DSTemp: TAdoDataSet;
Blob: TStream;
fs: TFileStream;
if St[8] <> '' then
begin
Blob := DSTemp.CreateBlobStream(DS Temp.Field ByName('Ek File'), bmWrite);
try
Blob.Seek(0, soFromBeginning);
fs := TFileStream.Create(St[8], fmOpenRead or fmShareDenyWrite);
try
Blob.CopyFrom(fs, fs.Size);
finally
fs.Free;
end;
finally
Blob.Free;
end;
end;
it gives error "invalid typecast" at runtime
when below line executes
Blob := DSTemp.CreateBlobStream(DS Temp.Field ByName('Ek File'), bmWrite);
when i change Blob: TBlobStream
it gives error : Incompatible types TBlobStream and TStream
why ?
also
EkFile -> varbinary -> 50
what is 50 for max filesize ? 50 byte ?
thanx
MeCeX
i want to save a file to a ms sql server database table
first i create a row
EkFile -> varbinary -> 50
then at delphi i wrote these lines
DSTemp: TAdoDataSet;
Blob: TStream;
fs: TFileStream;
if St[8] <> '' then
begin
Blob := DSTemp.CreateBlobStream(DS
try
Blob.Seek(0, soFromBeginning);
fs := TFileStream.Create(St[8], fmOpenRead or fmShareDenyWrite);
try
Blob.CopyFrom(fs, fs.Size);
finally
fs.Free;
end;
finally
Blob.Free;
end;
end;
it gives error "invalid typecast" at runtime
when below line executes
Blob := DSTemp.CreateBlobStream(DS
when i change Blob: TBlobStream
it gives error : Incompatible types TBlobStream and TStream
why ?
also
EkFile -> varbinary -> 50
what is 50 for max filesize ? 50 byte ?
thanx
MeCeX
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.