Solved

Insert new record by using DBNavigator

Posted on 2004-04-26
8
533 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
 
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
What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

 

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

Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

Join & Write a Comment

Suggested Solutions

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…
Introduction Raise your hands if you were as upset with FireMonkey as I was when I discovered that there was no TListview.  I use TListView in almost all of my applications I've written, and I was not going to compromise by resorting to TStringGrid…
This video discusses moving either the default database or any database to a new volume.
In this tutorial you'll learn about bandwidth monitoring with flows and packet sniffing with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're interested in additional methods for monitoring bandwidt…

707 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

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now