Solved

Insert new record by using DBNavigator

Posted on 2004-04-26
8
554 Views
Last Modified: 2010-04-05
I have 6 fields (title,quit,answ,wrong1,wrong2 and wrong3 )>>
I do not like to write value of "title" every inserting so I want to fixed the text of editbox
so when I insert new recorde all editboxs will be clear exept the editbox of "title"?
0
Comment
Question by:sal1150
  • 3
  • 2
  • 2
  • +1
8 Comments
 
LVL 12

Expert Comment

by:esoftbg
ID: 10921456
Usualy TDBNavigator works together with TDBGrid and / or TDBEdits. If your data will be entered into TEdits, you don't need a TDBNavigator to post a new record, but you can use a button....
0
 
LVL 12

Expert Comment

by:esoftbg
ID: 10921535
what kind of database do you use ?
0
 
LVL 11

Expert Comment

by:shaneholmes
ID: 10921569
in your code,

create a Global variable

Example:

var
 MYText: String;


Set the tables Fields Default value = to your title

MyTableField.AsString:= MyText;

OR

select the DBNavigator

Go to its buttons property, and select the insert button

then go to its onCLick event

procedure TfrmTeams.wwDBNavigator1InsertClick(Sender: TObject);
begin
 DBEdit1.Text:=  MyText;
end;


Now anytime, MyText valeu changes and you do a insert from the TDBNavigator, you rDBEdit will be updated with the new default value

Shane
0
Netscaler Common Configuration How To guides

If you use NetScaler you will want to see these guides. The NetScaler How To Guides show administrators how to get NetScaler up and configured by providing instructions for common scenarios and some not so common ones.

 
LVL 17

Expert Comment

by:mokule
ID: 10921635
Hi
I understand that Your database is in early stage so I advise You:
Divide Your data into 2 tables

Table Titles with fields Tit_Id, Tit_Title
Table Answers with fields Ans_Id, Ans_TitleId, Ans_quit,Ans_answer, ...

Let Tit_Id and Ans_Id be autoincrement fields and Key fields.
Field Ans_TitleId should be equal to Tit_Id Field for corresponding title

Maybe it's a little bit more difficult in implementation but has some important advantages.
First of all in case of erroneous Title You need to correct only one record.
Besides Your databese will be more compact.
0
 

Author Comment

by:sal1150
ID: 10921756
shaneholmes
can u explane more...I do not find "buttons property"
0
 
LVL 11

Expert Comment

by:shaneholmes
ID: 10921826
Click on the DBNavigator so that it is selected, then there is a buttons property in the object inspector which gives you access to the buttons of the DBNavigator. Click the ellipse to get to each individula button, click on the insert

SHane
0
 

Author Comment

by:sal1150
ID: 10922414
sorry i did not find  "buttons property"
did u mean "visiblebuttons"?
0
 
LVL 11

Accepted Solution

by:
shaneholmes earned 250 total points
ID: 10922466
Duh, my bag - what a freak I am, I was giving you the instructions for a InfoPower component which i use alot

Sorry -

Do the following:

In YOUR TDBNavigators OnCLick event, add the following:

if Button = nbInsert then
              DBEdit1.Text:=  MyText;


OR


case button of
 nbInsert: begin
                DBEdit1.Text:=  MyText;
               end:
 nbDelete:begin
                 //  
               end;
 etc, etc, etc,
end;

Shane
0

Featured Post

Efficient way to get backups off site to Azure

This user guide provides instructions on how to deploy and configure both a StoneFly Scale Out NAS Enterprise Cloud Drive virtual machine and Veeam Cloud Connect in the Microsoft Azure Cloud.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
FMX StringGrid1->Canvas->FillRect Problem 3 153
Dev Express grid collapse 2 45
update joined tables 2 46
How to make Sign in, using Clientdataset? 1 19
Have you ever had your Delphi form/application just hanging while waiting for data to load? This is the article to read if you want to learn some things about adding threads for data loading in the background. First, I'll setup a general applica…
Hello everybody This Article will show you how to validate number with TEdit control, What's the TEdit control? TEdit is a standard Windows edit control on a form, it allows to user to write, read and copy/paste single line of text. Usua…
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…

777 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