Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Insert new record by using DBNavigator

Posted on 2004-04-26
8
Medium Priority
?
721 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 
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 1000 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

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

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

This article explains how to create forms/units independent of other forms/units object names in a delphi project. Have you ever created a form for user input in a Delphi project and then had the need to have that same form in a other Delphi proj…
Objective: - This article will help user in how to convert their numeric value become words. How to use 1. You can copy this code in your Unit as function 2. than you can perform your function by type this code The Code   (CODE) The Im…
Sometimes it takes a new vantage point, apart from our everyday security practices, to truly see our Active Directory (AD) vulnerabilities. We get used to implementing the same techniques and checking the same areas for a breach. This pattern can re…
How to fix incompatible JVM issue while installing Eclipse While installing Eclipse in windows, got one error like above and unable to proceed with the installation. This video describes how to successfully install Eclipse. How to solve incompa…

688 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