Solved

Insert new record by using DBNavigator

Posted on 2004-04-26
8
641 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
[Live Webinar] The Cloud Skills Gap

As Cloud technologies come of age, business leaders grapple with the impact it has on their team's skills and the gap associated with the use of a cloud platform.

Join experts from 451 Research and Concerto Cloud Services on July 27th where we will examine fact and fiction.

 
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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

A lot of questions regard threads in Delphi.   One of the more specific questions is how to show progress of the thread.   Updating a progressbar from inside a thread is a mistake. A solution to this would be to send a synchronized message to the…
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…
NetCrunch network monitor is a highly extensive platform for network monitoring and alert generation. In this video you'll see a live demo of NetCrunch with most notable features explained in a walk-through manner. You'll also get to know the philos…
Michael from AdRem Software explains how to view the most utilized and worst performing nodes in your network, by accessing the Top Charts view in NetCrunch network monitor (https://www.adremsoft.com/). Top Charts is a view in which you can set seve…
Suggested Courses
Course of the Month8 days, 3 hours left to enroll

617 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