Delphi XE3 - Copying data from a TBytesField to another TBytesField

I have a ADO dataset (DataSet1) with TBytesField and the DataSize of the field is 12. 
I want to copy the TBytesField data to another DataSet having a TBytesField with DataSize 12.
I used the given below line of code to copy the field value from DataSet1 to DataSet2:
DataSet2.Fields[0].Value := DataSet1.Fields[0].Value.
This code was working in Delphi 2009. 
But after migrating to Delphi XE3, this is not working anymore. It raises an error "Invalid variant type" while trying to set the value.
I tried to use GetData and SetData but same error comes. I think there is a bug with Delphi XE3 ADODB code while setting the data.
Anybody experienced this problem? Any suggestions?
0
Soji
4/2/2013 4:24:09 PM
embarcadero.delphi.ado 597 articles. 1 followers. Follow

2 Replies
1293 Views

Similar Articles

[PageSpeed] 26

> {quote:title=Soji Mathew wrote:}{quote}
> I have a ADO dataset (DataSet1) with TBytesField and the DataSize of the field is 12. 
> I want to copy the TBytesField data to another DataSet having a TBytesField with DataSize 12.
> I used the given below line of code to copy the field value from DataSet1 to DataSet2:
> DataSet2.Fields[0].Value := DataSet1.Fields[0].Value.

Did you consider using the 'TBytesField.AsBytes', which seems to be exactly what should be used?

{code}
DataSet2.Fields[0].AsBytes := DataSet1.Fields[0].AsBytes;
{code}

Edited by: Ken White on Apr 23, 2013 3:50 PM
0
Ken
4/23/2013 7:50:51 PM
Ken White,

Thanks for the reply.

I tried using "AsBytes" before posting the issue. It did not work because there is a bug with the Delphi XE3. 
I reported the bug in Quality central and they resolved the bug and the fix is available in Delphi XE4! 
So I have to buy Delphi XE4 now to avoid this issue!
This is a basic issue with Delphi XE3 code and I am shocked to see that they don't want to give any fix for XE3.

Mean time I found a workaround to avoid this issue. Set the TBytesField size to 16 and use TByteField.SetData with native format true.
The bug is with size calculation in VCL code.

 

> {quote:title=Ken White wrote:}{quote}
> > {quote:title=Soji Mathew wrote:}{quote}
> > I have a ADO dataset (DataSet1) with TBytesField and the DataSize of the field is 12. 
> > I want to copy the TBytesField data to another DataSet having a TBytesField with DataSize 12.
> > I used the given below line of code to copy the field value from DataSet1 to DataSet2:
> > DataSet2.Fields[0].Value := DataSet1.Fields[0].Value.
> 
> Did you consider using the 'TBytesField.AsBytes', which seems to be exactly what should be used?
> 
> {code}
> DataSet2.Fields[0].AsBytes := DataSet1.Fields[0].AsBytes;
> {code}
> 
> Edited by: Ken White on Apr 23, 2013 3:50 PM
0
Edward
4/23/2013 8:11:08 PM
Reply:

Similar Artilces:

Delphi XE3 plus CBuilder XE3 demo is still Delphi only
Have Delphi XE3 installed (and registered), tried to install the CBuilder XE3 demo to see if it work as required. The result is that only Delphi was updated and no CBuilder available. Is there a way to test it - I would have upgraded to full RadStudio but doubted the CBuilder 64 bit compiler would be available in time (deadline is almost here and already ported the code to VC++ but don't particularly like it). ...

Convert Delphi 5 ADO App to Delphi 2007 ADO.NET
I have an appliction tha that is writen in Delphi 5 with ADOConnetion, ADOTable, and ADOQuery components. I need to upgrade to Delphi 2007 and use ADO.NET. I have the program building in with Delphi 2007. Is there anything I need to do to convert the ADO to ADO.NET? > I need to upgrade to Delphi 2007 and use ADO.NET. Why ? -- With best regards, Dmitry Arefiev AnyDAC (www.anydac.com) - Oracle, MS SQL Server, IBM DB2, MySQL, Firebird, Interbase, PostgreSQL, Sybase ASA, SQLite, MS Access, DBX, ODBC, InMem - universal high-speed native data access engine Reasons for ...

Delphi 2010 professional to Delphi XE3
Hello, Sorry for this is not right place to ask this question: I have Delphi 2010 professional version, I like to upgrade to Delphi XE3 Am eligible to upgrade or no not? I like answer from Delphi sales team. I couldn’t find email to ask them. Thanks Mike Thomas <> wrote in news:506459@forums.embarcadero.com: > Hello, > > Sorry for this is not right place to ask this question: > I have Delphi 2010 professional version, I like to upgrade to Delphi > XE3 Am eligible to upgrade or no not? I like answer from Delphi > sales team. I couldn’t find emai...

Migrating from Delphi 7 to Delphi XE3
Hello, Its time to leave the old Delphi 7 and move to the new (but not the latest) XE3. I was wondering if there is a good book or reference to learn all new things XE3 added. Any suggestions? On 5/3/2013 10:17 PM, George Karatsiolis wrote: > Hello, Its time to leave the old Delphi 7 and move to the new (but not the latest) XE3. > I was wondering if there is a good book or reference to learn all new things XE3 added. Try this one for starters: http://tinyurl.com/cgsu243 Aside from that you really need to evaluate your application. XE3 is Unicode for example.... So her...

Delphi 6 to Delphi 2010 upgrade and ADO
We have an application written in Delphi 6 Professional that uses ADO to access databases servers that may be on other PCs in our network. We want to move to Delphi 2010 but can't decide if we need Professional or Enterprise. 2010 Pro has dbGO - will this give us the same functionality as the ADO components we use in Delphi 6 Pro? Thanks, Keith > 2010 Pro has dbGO - will this give us the same functionality as the > ADO components we use in Delphi 6 Pro? Yes. > {quote:title=Joachim Uersfeld wrote:}{quote} > > 2010 Pro has dbGO - will this give us the same func...

How to use a delphi XE3 obj file in delphi 2007?
Hi, I'm migrating an application from delphi 2007 to delphi XE3 and I would like to do it in several steps. To do this I need to use a part of my new code (XE3) in the current delphi 2007 application. So I want to use the .obj file from my XE3 file. I know I have to use the {$L 'Filename'} and I know that I have to declare the functions that I want to use in external in my D2007 project. I wanted to make an easy and simple example to see how it works with only 1 function 'hello world' compiled in obj with XE3 but I can't find the way to use it in D2007. In D200...

Delphi and Delphi for .Net
It seems that Delphi for .Net is slower than Delphi Win32 native applicaiton. I would like to know is it true all .Net application is slower than Win32 native applicaiton or it is Delphi for .Net only. Your information is great appreciated, Inung On 2011-06-21 18:20:17 +0100, Inung Huang said: > It seems that Delphi for .Net is slower than Delphi Win32 native applicaiton. > I would like to know is it true all .Net application is slower than > Win32 native applicaiton or it is Delphi for .Net only. If you are only running the code in the application once then, yes, yo...

ArcGIS runtime errors after upgrading from Delphi 2007 to Delphi XE3
We have an application written in Delphi Pascal that accesses the ArcGIS 9.3 API through the COM interface. We recently upgraded from Delphi 2007 to Delphi XE3 and ever since we upgraded we have been getting runtime errors in the ArcGIS libraries that we were not getting before. Specifically the error is always "invalid floating point operation". The first one that was occurring was happening in the method "sg.SgCoordRefSetZ". I was able to eliminate this error by adding a call to FGeoSpatialReference.SetZDomain(-10000, 100000.0) even though there is nowhere that we&#...

Re: Where is data form wizard in Delphi 2009? [pubic.delphi.ide]
This message is in MIME format. Since your mail reader does not understand this format, some or all of this message may not be legible. --JivePart=_21560.zeB8CwDOH5aMJzMl Content-Type: text/plain; charset="Utf-8" Sample picture showing drag and drop from persistent fields edit window. (Any TField in any TDataset should work, TSomeKindofTable, or TSomeKindofQuery. Warren --JivePart=_21560.zeB8CwDOH5aMJzMl Content-Type: image/jpeg; name="drag_and_drop_from_persistent_fields_editor.jpg" Content-Transfer-Encoding: base64 Content-Disposition: attachment; ...

Debugging in Delphi XE2 using another Delphi BDS process as host
Hi I've been using delphi a long time And I always had the possibility of debbuging Packages using another Delphi process as host. This is very useful to test the design-time side of packages. Now with XE 2 I can whether running with options - Debugger - Host Application or Attach to process Any ideas? Thanks Plp Pedro wrote: > Now with XE 2 I can whether running with options - Debugger - Host > Application or Attach to process What exactly are you having trouble with? Error messages, unexpected behavior, etc. -- Remy Lebeau (TeamB) Hi Remy ...

Is it posible to configure Delphi XE3 IDE to use Delphi 7 compiler/debuger
Hi! Like many other developer out there I have several project which has been developed with older version of Delphi (Delphi 7). Since theese projects rely on some components which are not compatible with newer versions of Delphi (no newer versions available) I'm forced to do any maintnance on theese projects using Delphi 7. Another solution would be to find replacment components which would provide me with same capabilities and work with latest versions of Delphi. But this would probbably require compleete rewritings of my projects (lots and lots of work). So currently I'm using...

SEPA components for Delphi with Source Code (Delphi 5
Hi all, in the european union change next year the Bankingformat to the SEPA Format. All peoples and companies must change the bankingssoftware and the costumer data form acountnummers in the new IBAN and BIC numbers. See: http://www.arma-it.de/shop/artikelueber.php?wgruppeid=211&wgruppe_offen=211 Functions: - generate SEPA XML'S - Calc IBAN - BIC Database (DE,AT and CH) Questions: vertrieb@arma-it.de PS: Bankinssoftware for Develpoers (Germany only) http://www.arma-it.de/shop/artikelueber.php?wgruppeid=212&wgruppe_offen=212 El 26/10/13 21:38, A...

Delphi 2007 to Delphi 7
I've written a class in Delphi 2007 that is not supported in Delphi 7. What would be the best way to achive what I've done in Delphi 2007 in Delphi 7? Thanks, Tom type BondConstants = class { Bond Types } type BondType = record const TREASURY = 3; AGENCY = 0; CORP = 1; MUNI = 2; SBA = 5; MBS = 4; CMO = 6; end; { Day Count Methods } type DayCount = record const ACTUAL_360 = 2; ACTUAL_365 = 1; ACTUAL_ACTUAL = 1; d30_360 = 0; ...

Delphi 4 to Delphi 2009
Hello, Thanks to all who answered my previous question. That was a great help. And atlast our client agreed to upgrade our delphi version from 4 to Delphi 2009. *Sigh*. But before that, I need to give the estimation and cost regarding the migration to delphi 2009. Can anyone tell me is there any tool to migrate from delphi 4 to delphi 2009 or just I need to compile our Delphi 4 application in Delphi 2009. I have read from the delphi 2009 feature matrix that Delphi 1 through Delphi 2007 import is possible in delphi 2009. But i am not that sure considering the size of our application. ...

Delphi 5 To Delphi 2009
I upgraded to Delphi 2009 from D5. The install says I can install Delphi and/or C++. Delphi installed OK but I see nothing of C++. What am I missing or does my upgrade not include C++? Thanks It depends on what you bought. If you bought Delphi 2009 only, that's what you get. If you bought Delphi 2009 and C++ Builder 2009 you get both. My guess is you got Delphi 2009 only. The simplest way to verify is look your invoice - it should say I would think. You could also go to members.embarcadero.com, login, then click on my registered products. There will be a textual description of...

Web resources about - Delphi XE3 - Copying data from a TBytesField to another TBytesField - embarcadero.delphi.ado

Resources last updated: 2/11/2016 7:24:02 AM