Article View: borland.public.cppbuilder.database.ado
Article #699Re: ValueListEditor and ADOBlobStream
From: Viatcheslav V. Vassiliev
Date: Thu, 14 Jul 2005 17:14
Date: Thu, 14 Jul 2005 17:14
57 lines
2691 bytes
2691 bytes
> { S = ValueList->Strings->Text.Length() + 1; char *P = new char[S];
Here you allocate P
> try
> { P = ValueList->Strings->Text.c_str();
Here you assign to P new value, previously allocated block is not
referenced. It is NOT copy operation.
> delete P;
Here you free memory from block returned by
ValueList->Strings->Text.c_str(), not block allocated in new char[S]. Later
C++ Builder frees AnsiString, but its memory is freed before by delete P.
AnsiString s = ValueList->Strings->Text;
BS->Write(S.c_str(), S.Length() + 1);
or something like this should work.
//------------------------------------------
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)
"Nerio" <ne_serzanti@tin.it> �������/�������� � �������� ���������:
news:42d692d4$1@newsgroups.borland.com...
>I wrote part of a program where, in a ADODataSet, record by record I
>collect a lot of field names and their respective content transferring them
>into a ValueListEditor. Next :
> ---
> ADOTableX->Edit();
> TADOBlobStream *BS = new TADOBlobStream TBlobField *) ADOTableXAnalisys,
> bmWrite);
> try
> BS->Write(P, S);
> }
> catch(...)
> { delete P; throw; }
> delete P;
> }
> catch(...)
> { delete BS; throw; }
> delete BS;
> ADOTableX->Post; // all those to fill the Access BlobField named Analisys
> ---
> passing to to following record but I have an access exception writing to
> the blob field (not always at the same record)
> Can you explain what happen
> Thanks Nerio
>
>
Technical Details
Message-ID:
<42d69d70$1@newsgroups.borland.com>Path:
arc1-ca.pugleaf.net!g2news1.google.com!news4.google.com!news.glorb.com!newsfeed.inode.at!reader.uucp.at!feeder02.uucp.at!newsfeed.uucp.at!news.uucp.at!newsgroups.borland.com!not-for-mailReferences:
<42d692d4$1@newsgroups.borland.com>Show Full Headers
Complete Article Headers
X-Google-Thread: 10698b,429fab098c07d30 X-Google-Attributes: gid10698b,public X-Google-Language: ENGLISH,ASCII From: "Viatcheslav V. Vassiliev" <support@oledbdirect.com> Newsgroups: borland.public.cppbuilder.database.ado References: <42d692d4$1@newsgroups.borland.com> Subject: Re: ValueListEditor and ADOBlobStream Date: Thu, 14 Jul 2005 21:14:25 +0400 Lines: 59 X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2900.2527 X-RFC2646: Format=Flowed; Response X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2527 NNTP-Posting-Host: 85.93.138.132 Message-ID: <42d69d70$1@newsgroups.borland.com> X-Trace: newsgroups.borland.com 1121361264 85.93.138.132 (14 Jul 2005 10:14:24 -0700) Path: arc1-ca.pugleaf.net!g2news1.google.com!news4.google.com!news.glorb.com!newsfeed.inode.at!reader.uucp.at!feeder02.uucp.at!newsfeed.uucp.at!news.uucp.at!newsgroups.borland.com!not-for-mail