BorlandTalk.com Forum Index BorlandTalk.com
Borland discussion newsgroups
 
Archives   FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

ValueListEditor and ADOBlobStream

 
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> C++ Builder Databases (ADO)
View previous topic :: View next topic  
Author Message
Nerio
Guest





PostPosted: Thu Jul 14, 2005 4:29 pm    Post subject: ValueListEditor and ADOBlobStream Reply with quote



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


Back to top
Viatcheslav V. Vassiliev
Guest





PostPosted: Thu Jul 14, 2005 5:14 pm    Post subject: Re: ValueListEditor and ADOBlobStream Reply with quote



Quote:
{ S = ValueList->Strings->Text.Length() + 1; char *P = new char[S];

Here you allocate P

Quote:
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.

Quote:
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 (AT) tin (DOT) it> сообщил/сообщила в новостях следующее:
news:42d692d4$1 (AT) newsgroups (DOT) borland.com...
Quote:
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





Back to top
Nerio
Guest





PostPosted: Thu Jul 14, 2005 9:09 pm    Post subject: Re: ValueListEditor and ADOBlobStream Reply with quote



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


Back to top
Nerio
Guest





PostPosted: Fri Jul 15, 2005 9:11 am    Post subject: Re: ValueListEditor and ADOBlobStream Reply with quote

Reading problem by TBlobStream solved. Thanks
Nerio


Back to top
Display posts from previous:   
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> C++ Builder Databases (ADO) All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2006 phpBB Group
SEO toolkit © 2004-2006 webmedic.