Thread View: borland.public.cppbuilder.database.ado
4 messages
4 total messages
Started by Daniel Stevanovic
Sun, 29 May 2005 18:54
problem with insert/get image in MSSQL2K using ADO & C++ Builder 6
Author: Daniel Stevanovic
Date: Sun, 29 May 2005 18:54
Date: Sun, 29 May 2005 18:54
17 lines
1274 bytes
1274 bytes
Does anyone knows why this doesn't work ? Please :(
table->Insert(); // table: TADOTable
...
TMemoryStream *ms=new TMemoryStream();
Image1->Picture->Bitmap->SaveToStream(ms); // Image1: TImage
component
try
{
((TBlobField*)table->Fields->Fields[4])->LoadFromStream(ms);
}
__finally
{
delete ms;
}
table->Post();
Re: problem with insert/get image in MSSQL2K using ADO & C++ Builder 6
Author: Vladimir Stefanovic
Date: Sun, 29 May 2005 19:28
Date: Sun, 29 May 2005 19:28
47 lines
2114 bytes
2114 bytes
I have this saved in my archive, for similar approach connected
to TRichEdit. It's *untested*:
<quote>
TMemoryStream* MemStream = new TMemoryStream();
RichEdit1->SaveToStream( MemStream );
MemStream->Seek( 0, soFromBeginning );
TBlobStream* DBStream = (TBlobStream*) DataSet1->CreateBlobStream(
DataSet1->FieldByName("field name"), bmReadWrite );
DBStream->CopyFrom( MemStream, MemStream->Size );
DataSet1->Post();
delete MemStream;
delete DBStream;
</quote>
--
Best regards,
Vladimir Stefanovic
"Daniel Stevanovic" <danste@neobee.net> wrote in message
news:429a1002@newsgroups.borland.com...
> Does anyone knows why this doesn't work ? Please :(
>
> table->Insert(); // table: TADOTable
> ...
> TMemoryStream *ms=new TMemoryStream();
> Image1->Picture->Bitmap->SaveToStream(ms); // Image1: TImage
> component
> try
> {
> ((TBlobField*)table->Fields->Fields[4])->LoadFromStream(ms);
> }
> __finally
> {
> delete ms;
> }
>
> table->Post();
>
>
>
Re: problem with insert/get image in MSSQL2K using ADO & C++ Builder 6
Author: Viatcheslav V. Vassiliev
Date: Mon, 30 May 2005 06:50
Date: Mon, 30 May 2005 06:50
32 lines
1941 bytes
1941 bytes
Try ms->Seek(0, soFromBeginning) after save.
//------------------------------------------
Regards,
Vassiliev V. V.
http://www.managed-vcl.com - using .Net objects in Delphi for Win32 +
ADO.Net
http://www.oledbdirect.com - The fastest way to access MS SQL Server,
MS Jet (Access) and Interbase (through OLEDB)
"Daniel Stevanovic" <danste@neobee.net> �������/�������� � ��������
���������: news:429a1002@newsgroups.borland.com...
> Does anyone knows why this doesn't work ? Please :(
>
> table->Insert(); // table: TADOTable
> ...
> TMemoryStream *ms=new TMemoryStream();
> Image1->Picture->Bitmap->SaveToStream(ms); // Image1: TImage
> component
> try
> {
> ((TBlobField*)table->Fields->Fields[4])->LoadFromStream(ms);
> }
> __finally
> {
> delete ms;
> }
>
> table->Post();
>
>
>
Re: problem with insert/get image in MSSQL2K using ADO & C++ Builder 6
Author: Daniel Stevanovic
Date: Mon, 30 May 2005 10:09
Date: Mon, 30 May 2005 10:09
42 lines
2228 bytes
2228 bytes
Thank you.
> Try ms->Seek(0, soFromBeginning) after save.
That was the problem. I figure it out last night.
"Viatcheslav V. Vassiliev" <support@oledbdirect.com> wrote in message
news:429ab7a2$1@newsgroups.borland.com...
> Try ms->Seek(0, soFromBeginning) after save.
>
> //------------------------------------------
> Regards,
> Vassiliev V. V.
> http://www.managed-vcl.com - using .Net objects in Delphi for Win32 +
> ADO.Net
> http://www.oledbdirect.com - The fastest way to access MS SQL Server,
> MS Jet (Access) and Interbase (through OLEDB)
>
> "Daniel Stevanovic" <danste@neobee.net> �������/�������� � ��������
> ���������: news:429a1002@newsgroups.borland.com...
> > Does anyone knows why this doesn't work ? Please :(
> >
> > table->Insert(); // table: TADOTable
> > ...
> > TMemoryStream *ms=new TMemoryStream();
> > Image1->Picture->Bitmap->SaveToStream(ms); // Image1: TImage
> > component
> > try
> > {
> > ((TBlobField*)table->Fields->Fields[4])->LoadFromStream(ms);
> > }
> > __finally
> > {
> > delete ms;
> > }
> >
> > table->Post();
> >
> >
> >
>
>
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads