Having two queries over the same table, in order to copy record from one to the other.
If I have a Tfmtmemofield, an exception is raised when I try to assign it to its correspondent target field:
Query1.sql.text:='Select * from tableA where proposta=1';
Query2.sql.text:='Select * from tableA';
pp:=2;
ano:=2011;
Query1.first;
while not Query1.eof do
begin
Query2.insert;
for m:=0 to Query2.FieldCount-1 do Query2.Fields[m].Assign(Query1.fieldbyname(Query2.fields[m].fieldname));
Query2Proposta.asinteger:=pp;
Query2ano.asinteger:=a;
Query2Aprovado.AsBoolean:=false;
Query2.post; raises : Invalid character value for cast specification Parameter[35] :[Texto] - invalid Value (Status = 2h).
Query3.next;
end;
Query1.next;
end;
The content of the field "texto" is a richtext produced by a standard trichmemo delphi component.
This works fine under Sdac.
Could this be an incompatibility between Query parameter and Latin1 charset?
tfmtmemofield incompatible
-
AndreyZ
-
luis_augusto
- Posts: 43
- Joined: Fri 14 Oct 2005 13:45
Ops! I believe this can help!
Dear sirs,
The problem I reported is due to the following reason:
Query1 fields are defined by a sentence, therefore a formatted memo field is automatically set to ftblob (blobtype property).
Query2 fields are designtime defined and the blobtype property of their tmemofields is set to ftfmtmemo, in order to support richtext contents.
This was working alright, in SDAC, now this assignment is no longer possible.
Then, in order to overcome that obstacle, I have to write the following code after the opening of query1:
tblobfield(Query1.FieldByName('Texto')).BlobType:=ftFmtMemo;
This willl be a problem, since I have several situations where I will have to make this association.
Can you fix this?
The problem I reported is due to the following reason:
Query1 fields are defined by a sentence, therefore a formatted memo field is automatically set to ftblob (blobtype property).
Query2 fields are designtime defined and the blobtype property of their tmemofields is set to ftfmtmemo, in order to support richtext contents.
This was working alright, in SDAC, now this assignment is no longer possible.
Then, in order to overcome that obstacle, I have to write the following code after the opening of query1:
tblobfield(Query1.FieldByName('Texto')).BlobType:=ftFmtMemo;
This willl be a problem, since I have several situations where I will have to make this association.
Can you fix this?
-
AndreyZ