TIP: Click on subject to list as thread! ANSI
echo: delphi
to: RON TUYNMAN
from: ROB WILLIAMS
date: 1997-07-09 17:26:00
subject: RE: Visual basic vs. Delp

  > ...Yep! A problem is though that whenever I eventually sell an
  > application I'll always have to deliver all the databases too... I'm
  > used to create those databases 'on the fly' whenever my application
  > detects there not present in their own directory...
You can do that too, although with version 1.0, it is different than
2.0.  There is a way to do it, though.  Here is some sample code from
2.0, maybe it will help you with v1.0:
      TestTable.Active := False;
      TestTable.DatabaseName := 'TEST';
      TestTable.TableName := 'TestStuff';
      TtestTable.TableType := ttDBase;
      with TtestTable.FieldDefs do
        begin
          Clear;
          Add('USERNAME',   ftString,   72, False);
          Add('USERID',     ftInteger,  0,  False);
        end;
      with TestTable.IndexDefs do
        begin
          Clear;
          Add('USERID',    'USERID',    [ixPrimary, ixUnique]);
        end;
      TestTable.CreateTable;
      TestTable.Active := true;
      TestTable.Open
RT> RW> You might have
  > RW> better luck with Paradox databases, as they support more datatypes,
  > RW> etc.
  >  ...As a test-project I'm transferring a succesfull application of
  >  mine to a Delphi-version. But I don't want my customers to loose all
  >  their data.
Well, I have bad news....I looked around, and unless I missed something,
you are right, you can't attach a UDF to an index.  You can attach an
expression to an index (firstname+lastname), but not a function.  It
appears to state pretty plainly in the docs that you can't do that.
Indexes in paradox are even more limited, you can just create an index
on the field itself.
RT> RW> I couldn't tell you why it won't work in Delphi 1....But it does work
  > RW> really slick in 2.0!  In 1.0, if you do what I explained earlier,
  > ...Sorry: I think I've missed that solution. Could you be so kind to
  > repeat that solution?
Create a form that just has your databases (tables, and datasource) on
it.  Then, in the CreateForm method in the forms you want to use the
databases, do the following:  (make sure you add the dataform to your
uses statement at the top of each form, too)
  Field1.DataSource := DataForm.DataSource1;
  Field2.DataSource := DataForm.DataSource1;
  Field3.DataSource := DataForm.DataSource1;
Etc, etc, etc.....There may be a faster way to do it by using some of
the functions to loop through all the components on the form, but I
never got that far, as I can do it the "right" way with Delphi 2.
RT> ...You're leaving the personal factor out. But for me I think that's
  > the biggest factor for RAD: the time I'm searching and failing.. :-|
  > I've seen people 'do magic' with Clarion. But for the time beeing
  > I'll keep with Delphi. With the databaseform-expert I'm managing to
  > create some forms with dataaccess (every time another instance,
  > though...)
Sounds like you are progressing....It takes time, but the more you work
with it, the easier it becomes!
Rob
---
 þ QMPro 1.53 þ WCS Software!-BBS Doors! (503)631-8439/wcssoft.com
---------------
* Origin: WCS Online!-BBS Doors-Internet-503-631-8439@wcssoft.co (1:105/278)

SOURCE: echomail via exec-pc

Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.