SQL databases - reading and writing: Delphi 1.02 
Author Message
 SQL databases - reading and writing: Delphi 1.02

After having played around with TTable for a while, I am now embarking
on TQuery and I have a few queries of my own.

(This first question applies to TTable too)
I need to be able to apply a mask to the input fields for the records
rather than let the database catch the errors. Are there any DB aware
controls that will let me do this?

Do I need to use a separate TQuery for each type of operation I perform
on the dataset? I ask this since I understand that the SQL string for a
TQuery can only hold a single statement. This would mean that for a form
which allows the user to insert, delete or amend a record, I would need
three separate TQueries!

Is the way of getting data from a field into a record only via Params?

The problem of all this verbose and explicit coding is the maintenance
issue. Do I understand TQueries correctly or am I barking up the wrong
tree?

Any help gratefully appreciated.

--
Sol Barron



Fri, 18 Dec 1998 03:00:00 GMT  
 SQL databases - reading and writing: Delphi 1.02

Quote:

> After having played around with TTable for a while, I am now embarking
> on TQuery and I have a few queries of my own.

> (This first question applies to TTable too)
> I need to be able to apply a mask to the input fields for the records
> rather than let the database catch the errors. Are there any DB aware
> controls that will let me do this?

Double-click on your TQuery or TTable and see what happens: after
adding the TFields, you'll see a property MaskEdit... Check
online-help for that.

Quote:
> Do I need to use a separate TQuery for each type of operation I perform
> on the dataset? I ask this since I understand that the SQL string for a
> TQuery can only hold a single statement. This would mean that for a form
> which allows the user to insert, delete or amend a record, I would need
> three separate TQueries!

> Is the way of getting data from a field into a record only via Params?

> The problem of all this verbose and explicit coding is the maintenance
> issue. Do I understand TQueries correctly or am I barking up the wrong
> tree?

Well, yes and no, as you will find out. Most important thing to
remember is that the SQL-property is of type TStrings and you can make
it dynamic by assigning other strings than the one predefined. Under
circumstances, you will not have to, because TQueries can return a
live result set, meaning that, while you use a simple "select ..", it
is updatable! The BDE takes care of the conversion...

Check online-help too for the properties of TQuery, especially
RequestLive...

Good luck!
Jasper

PS: please take into consideration
- when replying, I just think I know;
- when asking, be sure that I don't.



Sat, 19 Dec 1998 03:00:00 GMT  
 SQL databases - reading and writing: Delphi 1.02

Quote:

> After having played around with TTable for a while, I am now embarking
> on TQuery and I have a few queries of my own.

> The problem of all this verbose and explicit coding is the maintenance
> issue. Do I understand TQueries correctly or am I barking up the wrong
> tree?

> Any help gratefully appreciated.

> --
> Sol Barron

Hi,

Quote:
> (This first question applies to TTable too)
> I need to be able to apply a mask to the input fields for the records
> rather than let the database catch the errors. Are there any DB aware
> controls that will let me do this?

This is not a feature of data-aware controls but of TField. TField has
(if I remember correctly (no Delphi here)) a DisplayMask and an EditMask.
Just double click on TTable and add the fields.

Quote:
> Do I need to use a separate TQuery for each type of operation I perform
> on the dataset? I ask this since I understand that the SQL string for a
> TQuery can only hold a single statement. This would mean that for a form
> which allows the user to insert, delete or amend a record, I would need
> three separate TQueries!

You must have the three strings for the SQL commands stored somewhere (I use
String Resources). But then you can use one query and exchange only TQuery.SQL.
BTW most of my queries are created during runtime.

Quote:
> Is the way of getting data from a field into a record only via Params?

I can only guess what you mean:
TQuery.Params?
  You can also create the SQL string dynamically, e.g.
  Query1.SQL[0] := Format ('select * from table where %s", [selectionstring]);

HTH.

ciao
       sm



Sat, 19 Dec 1998 03:00:00 GMT  
 SQL databases - reading and writing: Delphi 1.02



After having played around with TTable for a while, I am now embarking
on TQuery and I have a few queries of my own.
...
If you right mouse click on a table or query object at design time you
can select the columns you are interested in.  Having done this each
field has an entry in the Object Inspector.  These entries have a
multitude of properties the most useful being alignment, editmask &
readonly,

You only need one query object.  Instead of putting the query text on
the object put it in your code eg
   query1.sql.clear;
   query1.sql.add('select...where');
   ;
   query1.sql.clear;
   query1.sql.add('update...where');

Of course to perform updates you don't have to use queries at all you
can use query1.edit; query1.post;, etc providing your query has returned
a live data set.  You need to scan the help on this subject though.

dave



Mon, 28 Dec 1998 03:00:00 GMT  
 
 [ 4 post ] 

 Relevant Pages 

1. Probl with Delphi 1.02 to Oracle via SQL*NET

2. SQL server 4.21 via ODBC in Delphi 1.02

3. delphi 1.02 sql link for sybase connect error

4. Help: Local SQL international date format comparison - Delphi 1.02

5. Q:Personal Oracle 95 with Delphi 1.02/SQL-Links 16

6. Interbase 4.0 (Delphi 1.02 -> Delphi 3.0)

7. Delphi 2.0 - BDE under Win3.11 - Delphi 1.02

8. Small 'fix' to DBGrid (Delphi 1.02)

9. Multi-user access to Paradox tables in Delphi 1.02

10. Delphi CS 1.02 to Sybase Help

11. TTable component in Delphi 1.02 and Oracle 7.1:

12. Can you connect a Delphi 1.02 application to Oracle 7.3

 

 
Powered by phpBB® Forum Software