Thread View: borland.public.cppbuilder.database.ado
4 messages
4 total messages
Started by Nerio
Thu, 14 Jul 2005 16:29
ValueListEditor and ADOBlobStream
Author: Nerio
Date: Thu, 14 Jul 2005 16:29
Date: Thu, 14 Jul 2005 16:29
26 lines
1691 bytes
1691 bytes
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
{ S = ValueList->Strings->Text.Length() + 1; char *P = new char[S];
try
{ P = ValueList->Strings->Text.c_str();
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
Re: ValueListEditor and ADOBlobStream
Author: 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
>
>
Re: ValueListEditor and ADOBlobStream
Author: Nerio
Date: Thu, 14 Jul 2005 21:09
Date: Thu, 14 Jul 2005 21:09
10 lines
1318 bytes
1318 bytes
Very good Excuse if I exceed in questions but I have same problem with reading from BlobField. And more : how I can point to a row and then read Values content of a ValueListString (for key value I use Keys[index] and there is no problem. I would like to read some deep documentation on the matter and examples but I don't know where find them. Many tnx for help Nerio
Re: ValueListEditor and ADOBlobStream
Author: Nerio
Date: Fri, 15 Jul 2005 09:11
Date: Fri, 15 Jul 2005 09:11
2 lines
1020 bytes
1020 bytes
Reading problem by TBlobStream solved. Thanks Nerio
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