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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Add field at runtime w/o deleting orig. fields??

Status
Not open for further replies.

cold25

Programmer
Feb 11, 2002
41
US
I'm trying to add a field to a .dbf file in a DBGrid at runtime. I've tried adding a persistent column through
DBGrid1.Columns.Add;
but this only results in one new column being added and all the original columns being deleted. How can I just add columns at runtime, which I can fill with data, without deleting all the original columns? Any help would be appreciated.

cold25
 
I'm not sure the syntax for dbf files or if you can even do it, but for most databases you can use a TQuery and do something like this:

Alter table yourtablename add YourField varchar(255) null

and then to a query.ExecSQL to add a field to the table.

Good luck! TealWren
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top