Small problem - putting strings into BLOB Type 1 field
Posted: Sun 01 Jul 2007 13:34
Hi!
I'm migrating from MySQL to FireBird 2.0 and while porting my code, I bumped into this problem.
The equivalent of MySQL "Text" type field is "Blob TYPE 1" in Firebird.
The problem is that when trying to parameterize a query, IBDAC 2.0 doesn't accept Strings the way it should do.
Like:
DBQuery.SQL.Text:='INSERT INTO TABLE(MyText) VALUES(:txt)';
DBQuery.ParamByName('txt').AsString:=Edit1.Text;
DBQuery.ExecSQL;
MyText is BLOB Type 1 of course.
The above yields the error "can't move data into blob field" or something to that extent.
If I modify the second line by changing AsString into AsBlob
DBQuery.ParamByName('txt').AsBlob:=Edit1.Text;
The problem is solved.
Why I'm asking for help is because I'm already modifying a huge base of code, and it would annoying if I had to rewrite all my "AsString" params to "AsBlob"...
Is there are workaround for this without me having to modify a lot of code?
Thanks in Advance!
Z
I'm migrating from MySQL to FireBird 2.0 and while porting my code, I bumped into this problem.
The equivalent of MySQL "Text" type field is "Blob TYPE 1" in Firebird.
The problem is that when trying to parameterize a query, IBDAC 2.0 doesn't accept Strings the way it should do.
Like:
DBQuery.SQL.Text:='INSERT INTO TABLE(MyText) VALUES(:txt)';
DBQuery.ParamByName('txt').AsString:=Edit1.Text;
DBQuery.ExecSQL;
MyText is BLOB Type 1 of course.
The above yields the error "can't move data into blob field" or something to that extent.
If I modify the second line by changing AsString into AsBlob
DBQuery.ParamByName('txt').AsBlob:=Edit1.Text;
The problem is solved.
Why I'm asking for help is because I'm already modifying a huge base of code, and it would annoying if I had to rewrite all my "AsString" params to "AsBlob"...
Is there are workaround for this without me having to modify a lot of code?
Thanks in Advance!
Z