Board index » delphi » Database programming - replacing DBnavigator and little more ...

Database programming - replacing DBnavigator and little more ...

Hi !
I have asked this question before and also got som advice, bu new
problems tend to arise. Anyhov - Im trying tro write a relational
database (a kind of questonaire with more pages on a tabbed notebook). I
do not want the users of this application to be able to see what others
have answered so for the sake of control I will omit the dbnavigator and
replace som of it functions bound to certain controls (knobs), s? that
the user can go from one page to the other. When pressing a knob I want
to post what the user have ansered and at the same time turn the page so
to say, to the next page/question. Now - my problems:
1) I was told that I should put my databases in edit-mode by writing
databasename1.edit and databasename2.edit in the "on click" event at the
first knob on the first page. Then I should write tablename1.post and
tablename2.post AND tableename1.append and tablename2.append in the on
click event handler on my last knob on the last page. I did this, but
now Delphi complains that it is impossible to post any data because my
tables (i.e. databases) are not open in edit mode !!! But when I check
the object inspector it says that my tables are active !!! How come.
What do I do wrong ?
2) The stupid application complicates things more thsn that, though. I
also get a message that Im trying to read beyon of file. Now I know
that one can write an exceptionhandler for this. But Im to much of a
nerd to do this. Where shall i put the code and how shall it relate to
my post- and appendcommands ?
Is there any help for me in this matter ? I would appreciate any comment
on this. Thanks.
              / Anders A :)

 

Re:Database programming - replacing DBnavigator and little more ...


Hi !
I have asked this question before and also got som advice, bu new
problems tend to arise. Anyhov - Im trying tro write a relational
database (a kind of questonaire with more pages on a tabbed notebook). I
do not want the users of this application to be able to see what others
have answered so for the sake of control I will omit the dbnavigator and
replace som of it functions bound to certain controls (knobs), s? that
the user can go from one page to the other. When pressing a knob I want
to post what the user have ansered and at the same time turn the page so
to say, to the next page/question. Now - my problems:
1) I was told that I should put my databases in edit-mode by writing
databasename1.edit and databasename2.edit in the "on click" event at the
first knob on the first page. Then I should write tablename1.post and
tablename2.post AND tableename1.append and tablename2.append in the on
click event handler on my last knob on the last page. I did this, but
now Delphi complains that it is impossible to post any data because my
tables (i.e. databases) are not open in edit mode !!! But when I check
the object inspector it says that my tables are active !!! How come.
What do I do wrong ?
2) The stupid application complicates things more thsn that, though. I
also get a message that Im trying to read beyon of file. Now I know
that one can write an exceptionhandler for this. But Im to much of a
nerd to do this. Where shall i put the code and how shall it relate to
my post- and appendcommands ?
Is there any help for me in this matter ? I would appreciate any comment
on this. Thanks.
              / Anders A :)

Re:Database programming - replacing DBnavigator and little more ...


Anders,

What you need to do is use the Append methods of each Table in the on click
event handler of the first knob on the first page, the Append and Post
methods of each Table in the on click event handler of All the knobs
between(and including) the first page and the second last page, and the
Post methods of each Table in the on click event handler of the last knob
on the last page.  Do not code: 'databasename1.edit OR databasename2.edit'
as TDatabase does not have an Edit method.  For example:

...
procedure TabbedNotebookActivate(Sender:TObject);
begin
  tableename1.Append;
  tablename2.Append;
end;

procedure AllPagesIncludingFirstButNotLastKnobClick(Sender:TObject);
begin
  tableename1.Post;
  tablename2.Post;
  ...
  DoTurnthePage; {i.e. however you handle turning the pages}
  ...
  tableename1.Append;
  tablename2.Append;
end;

procedure LastPageLastKnobClick(Sender:TObject);
begin
  tableename1.Post;
  tablename2.Post;
end;
...

Gavin

Anders Andren <anders.and...@mbox300.swipnet.se> wrote in article
<336689B0.4...@mbox300.swipnet.se>...

Quote
> Hi !
> I have asked this question before and also got som advice, bu new
> problems tend to arise. Anyhov - Im trying tro write a relational
> database (a kind of questonaire with more pages on a tabbed notebook). I
> do not want the users of this application to be able to see what others
> have answered so for the sake of control I will omit the dbnavigator and
> replace som of it functions bound to certain controls (knobs), s? that
> the user can go from one page to the other. When pressing a knob I want
> to post what the user have ansered and at the same time turn the page so
> to say, to the next page/question. Now - my problems:
> 1) I was told that I should put my databases in edit-mode by writing
> databasename1.edit and databasename2.edit in the "on click" event at the
> first knob on the first page. Then I should write tablename1.post and
> tablename2.post AND tableename1.append and tablename2.append in the on
> click event handler on my last knob on the last page. I did this, but
> now Delphi complains that it is impossible to post any data because my
> tables (i.e. databases) are not open in edit mode !!! But when I check
> the object inspector it says that my tables are active !!! How come.
> What do I do wrong ?
> 2) The stupid application complicates things more thsn that, though. I
> also get a message that Im trying to read beyon of file. Now I know
> that one can write an exceptionhandler for this. But Im to much of a
> nerd to do this. Where shall i put the code and how shall it relate to
> my post- and appendcommands ?
> Is there any help for me in this matter ? I would appreciate any comment
> on this. Thanks.
>               / Anders A :)

Re:Database programming - replacing DBnavigator and little more ...


Another problem .
Because I have a relational database - how do I operate post- and append
procedures without the dbnvigator from non-dataaware buttons. I mean
dbnavigator is related to the master-table. How do I mimic that function
from a non-dataaware button ?
I'm grateful for all tips that I could get. Thanks !

Re:Database programming - replacing DBnavigator and little more ...


table1.insert
table1.post
table1.delete
table1.edit
table1.first
table1.next
table1.last
table1.prior

Is that what you asked?

Anders Andren <anders.and...@mbox300.swipnet.se> skrev i inl?gg
<33690AF3.7...@mbox300.swipnet.se>...

Quote
> Another problem .
> Because I have a relational database - how do I operate post- and append
> procedures without the dbnvigator from non-dataaware buttons. I mean
> dbnavigator is related to the master-table. How do I mimic that function
> from a non-dataaware button ?
> I'm grateful for all tips that I could get. Thanks !

Other Threads