Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

changing values in a TTable

Status
Not open for further replies.

mjsof84

Programmer
Mar 23, 2003
22
0
0
GB
Hi again,

I'm looking for how to change the value of a field in my paradox database through delphi code.

given that it is possible to do form1.table1.append or form1.table1.delete, is it possible to use code to change the actual values in the fields?

For example

form1.table1.somethingidontknow := 58;

Any help much appreciated :)

 
You can change values in individual fields very easily.

One way:

form1.table1.Edit; //or form1.table1.Insert or Append;
form1.table1YOURFIELDNAME.Value := 58
form1.table1.Post;
or
form1.table1.Edit;
form1.table1YOURFIELDNAME.AsInteger :=58
form1.table1.Post;

For a string:
form1.table1.Edit;
form1.table1YOURFIELDNAME.AsString := Stringvalue;
form1.table1.Post;

Another way
form1.table1.Edit;
form1.table1.FieldByName('YOURFIELDNAME').Value:= 58;
form1.table1.Post;


And yet ANOTHER way!
form1.table1.Edit;
form1.table1.Fields[0].Value; // of the first table1 field;
form1.table1.Post;

Hope that helps!
Martin
 
I think for the first to examples you will have to add the fields in the Fields Editor, ie

Double click your TTable - to show the fields editor
Right click on it and select 'Add all fields'

lou
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top