Solved

remove fields form ttable

Posted on 2002-07-01
8
201 Views
Last Modified: 2010-04-04
To obtain points you will create a ttable dynamically and set it to the ‘dbdemos’ alias, open the parts.db table. You will remove the field Cost.

You may have a static datasource and a dbgrid for testing that it actually worked.
0
Comment
Question by:God_Ares
  • 5
  • 3
8 Comments
 
LVL 27

Expert Comment

by:kretzschmar
ID: 7121249
>you will create a ttable dynamically and set it to
>the ‘dbdemos’ alias

q : tquery;
begin
  q := tquery.create(self);
  try
    q.databasename := 'dbdemos';
    q.sql.text := 'create table Atable (field1 NUMBER, field2 CHAR(20))';
    q.execsql;
  finally
    q.free;
  end;
end;

just from head, other follows

meikl ;-)
0
 
LVL 27

Expert Comment

by:kretzschmar
ID: 7121251
>You will remove the field Cost.

q : tquery;
begin
 q := tquery.create(self);
 try
   q.databasename := 'dbdemos';
   q.sql.text := 'alter table parts drop costs'; //or alter table parts drop column costs
   q.execsql;
 finally
   q.free;
 end;
end;


just from head

meikl ;-)


0
 
LVL 27

Expert Comment

by:kretzschmar
ID: 7121253
forget the first one, i've misread it

btw. if you want to drop a field the table may not accessed/opened by anyone nor byself

meikl ;-)
0
 
LVL 7

Author Comment

by:God_Ares
ID: 7121272
sorry kretzschmar it needs to be a ttable. I know it's possible to remove fields (not actually remove fields from db). if you put an ttable on the form and set a table you can 'hide' a field by double clicking on it. you'll get an editor an you may remove fields. that's what i want yet i had trouble figuring out how to do it.

procedeure button1
begin
  t := ttable.create(self);
  t.DatabaseName := 'Dbdemos';
  t.TableName := 'parts.db';
  .....
  your code here
  .....

  DataSource1.DataSet := t;

end;

onclose.
  t.free

0
Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

 
LVL 27

Accepted Solution

by:
kretzschmar earned 100 total points
ID: 7121288
just set its visible-property to false like

table1.fieldbyname('costs').visible := false;

meikl ;-)
0
 
LVL 7

Author Comment

by:God_Ares
ID: 7121323
 t := ttable.create(self);
  t.DatabaseName := 'DBDEMOS';
  t.TableName := 'parts.db';

  t.Open; //<- Nessesary!!

  t.FieldByName('cost').Visible := 1=0;
0
 
LVL 27

Expert Comment

by:kretzschmar
ID: 7121328
yep, should work
0
 
LVL 7

Author Comment

by:God_Ares
ID: 7121336
yep that's it.
0

Featured Post

Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

Join & Write a Comment

Objective: - This article will help user in how to convert their numeric value become words. How to use 1. You can copy this code in your Unit as function 2. than you can perform your function by type this code The Code   (CODE) The Im…
In this tutorial I will show you how to use the Windows Speech API in Delphi. I will only cover basic functions such as text to speech and controlling the speed of the speech. SAPI Installation First you need to install the SAPI type library, th…
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now