Quote
Michael Koon wrote:
> Hello
> I need to save strings to the Oracle 7.3 database that are longer than 255
> characters. I am not using data-aware controls.
> I am using Delphi 1.0
> any help would be appreciated
> thx
> Michael Koon
You need to store the string in a column of the apropiate type.
For instance:
Interbase has a string type with up to ~35 kb storage.
SQL Base has LONG VARCHAR which is a Pointer to a dinamically allocated
space.
SQL does not support variable lenght types, so can't enter data with the
regular INSERT statement.
Accessing this from Delphi requires you to use a TBlobField or
TMemoField component. Since these fields are something like a handle to
the data, you can't just copy ( AA := BB ). Instead you use special
methods.
Example:
READING:
var
sl : TStringList
begin
sl := TStringList.Create;
AQuery.SQL.Add('select TEXT1 from TABLE1');
AQuery.Open;
AQuery.First;
sl.Assign(AQuery.FieldByName('TEXT1));
AQuery.Close;
end;
WRITING
var
sl : TStringList
begin
sl := TStringList.Create;
sl.Add('It works!');
AQuery.SQL.Add('select TEXT1 from TABLE1');
AQuery.RequestLive := true;
AQuery.Open;
AQuery.First;
AQuery.Edit; //or Append
AQuery.FieldByName('TEXT1).Assign(sl);
AQuery.Post;
AQuery.Close;
end;
Notice, that you can use Edit and Append only on live datasets!
Marco.