Beginner's questions regarding Delphi 
Author Message
 Beginner's questions regarding Delphi

Could somebody answer my beginner's questions.....Please!

1)In DBGrid, how can I display one field from a different table?
2)How do I display multiple fields in TDBCombobox? It only displays one  
  field...
3)I have picture set in Paradox and it works fine, but when I create a



Sat, 25 Jul 1998 03:00:00 GMT  
 Beginner's questions regarding Delphi
Could somebody anser my BEGINNER'S questions, please!!

1-How can I show a field from different table in the DBGrid? Can I
  combine 2 tables in one Grid?
2-Is there a way to show multiple fields in DBComboBox? I can only show
  one field.
3-I specified pictures in Paradox database, but when I create a project
  and run the program, it ignores pictures... where do I specify the
  picture?
4-How do I post a record in the database?
  I'm adding a customer, and DBGrid underneath to add items the customer
  purchased.  After adding the customer, when I try to add detail info
  it doesn't think the customer exists in the database....I think
  I just need to post the customer record before I get to the Grid....

I know these are very elementary questions....but I'd appreciate if
you can answer my questions.  Thank you!



Sat, 25 Jul 1998 03:00:00 GMT  
 Beginner's questions regarding Delphi

Quote:

>Could somebody anser my BEGINNER'S questions, please!!
>1-How can I show a field from different table in the DBGrid? Can I
>  combine 2 tables in one Grid?
>2-Is there a way to show multiple fields in DBComboBox? I can only show
>  one field.
>3-I specified pictures in Paradox database, but when I create a project
>  and run the program, it ignores pictures... where do I specify the
>  picture?
>4-How do I post a record in the database?
>  I'm adding a customer, and DBGrid underneath to add items the customer
>  purchased.  After adding the customer, when I try to add detail info
>  it doesn't think the customer exists in the database....I think
>  I just need to post the customer record before I get to the Grid....

1) Use a TQuery object and write an SQL statement which joins the
tables

2) No.  Not in a DBComboBox.  You can display multiple fields in a
DBLookupComboBox however.  Use the LookupDisplay property.

3) Sorry.  I don't use paradox.

4) You are right.  A post will actually post the new record to the
database.  The dataset is changed to browse state after a succesful
post.

-------------------
He who has never failed somewhere, that man can not be great.
-Herman Melville (1850)



Mon, 27 Jul 1998 03:00:00 GMT  
 Beginner's questions regarding Delphi

Quote:
>Could somebody answer my beginner's questions.....Please!

>1)In DBGrid, how can I display one field from a different table?

Fields from more than one table can appear automatically in the same
TDBGrid only when the data set for that TDBGrid is a TQuery that links,
through SQL, those multiple tables together. When you do this, all of the
fields in the SELECT query -- whether from only one or from all tables so
linked -- appear in the TDBGrid.

It is possible, though, to take special actions above and beyond the
automatic process described above to have fields from other tables appear
in a TDBGrid when the data set for that TDBGrid is based on only one table
(as with a TTable). One way to do this would be to set up calculated fields
and in the OnCalcFields event procedure for that TTable perform some
actions that put field values from the other table into the calculated
field. One example of such an action could be a look-up from the other
table based on a field value in the current record of the main table for
the TDBGrid. Calculated fields, though, will be read-only.

Quote:
>2)How do I display multiple fields in TDBCombobox? It only displays one  
>  field...

The Items property of the TDBComboBox component must be filled manually.
The values placed in each element of the Items property array of String
values can be a field from a table, some programmatically drived value,
literals created in the application, or a concatenation of multiple fields
from a table. There is no limitation in this component to displaying only a
single field value.

On the other hand, the list of values for a TDBLookupCombo does have some
limitations on what can be displayed. This component does not have an Items
property, and instead gets the values for the list directly from a table.
(Specifically, from a TTable component connected to a table and through a
TDataSource component.) The DataSource property designates the data source
from which any displayed values will come. The LookupField property
indicates the field in the source data set that will supply the value for
the TDBLookupCombo. This property is limited to only a single field because
it is that single field that would be inserted into a target data set,
designated through the DataSource and DataField properties. The
LookupDisplay property allows you to designate what field value or field
values will be displayed in the list. This property can be set so the
component displays only one or multiple fields from the source data set.

The values displayed in the TDBLookupCombo component's list will be
affected by the settings of the LookupField and LookupDisplay properties
taken as a set. The LookupField must always be set for the component to
display any field values at all. If the LookupField property is set to a
field in the source data set and LookupDisplay is left blank, only the
value for the field designated in LookupField will be displayed in the
list. If the LookupField property is set to a field in the source data set
and LookupDisplay is set to one or more fields, the field value or field
values set in LookupDisplay are what are displayed in the list. Regardless
of the setting of LookupDisplay, the field pointed to in LookupField is
always the value inserted into the targer data set and field (DataSource
and DataField properties), if these are designated at all.

When multiple fields are displayed in the TDBLookupCombo selection list,
the field are listed in order of desired appearance in the LookupDisplay
property, each separated by a semi-colon, as in:

  LookupDisplay := 'LASTNAME;FIRSTNAME;CITY';

Quote:
>3)I have picture set in Paradox and it works fine, but when I create a

The picture constraints you can define in the Database Desktop utility
(DBD) or Paradox itself for Paradox tables are not recognized or supported
by Delphi. If you want to apply a picture template to a field in a Delphi
application, you would either need to 1) use the TField component's
EditMask property or programmatically intercept end-user keystrokes at
run-time and allow or 2) disallow keys depending on the current position
within the field value or other developer-defined criteria.

**************************************************************************
Steve Koterski                    "Knowledge advances by steps, and not by
Product Group Manager             leaps."
Delphi Technical Support                       -- Lord Macaulay, 1800-1859
Borland International, Inc.



Mon, 27 Jul 1998 03:00:00 GMT  
 
 [ 4 post ] 

 Relevant Pages 

1. DelpLink/Delphi Question regarding keyword lists

2. Some lame questions regarding TP and Delphi

3. Idiot question regarding Delphi + SQL

4. Beginner's question

5. Delphi question for a beginner?

6. Question regarding Quick Report and runtime packages

7. Question regarding Borland Pascal with Objects v7.01 and

8. Couple of quick questions regarding txt files...

9. Question regarding Paradox table names, any comments?

10. If you have any questions regarding pascal...

11. help! A question regarding standard pascal programming

12. Question regarding tree traversal

 

 
Powered by phpBB® Forum Software