Solved

Insert and update records using a DB Navigator in Delphi

Posted on 2008-06-23
5
2,250 Views
Last Modified: 2013-11-23
I am looking for a db navigator to insert and update a Microsoft sql 2000 database using an ado query.

I have a dbnavigator on a form but eventually I want to use it on numerous forms in an application. I want the form to be locked until a user presses the edit/insert button on the navigator and then once this occurs the dbnavigator then only displays the post /cancel buttons. If the cancel button is pressed then no changes are made but if the post button is pressed then the database gets populated.

My table is called customers and has the following fields:

customer_link  int  4  no null
customername  nvarchar  50  no null
customerref  nvarchar  50  no null
website  nvarchar  50 allow null

I have tried to get the insert query to work but I have problems inserting a unique identifier into the field customer_link and I am struggling with the update query.

Thanks
0
Comment
Question by:ubernewb
  • 3
  • 2
5 Comments
 
LVL 10

Expert Comment

by:dinilud
ID: 21852650
0
 
LVL 10

Expert Comment

by:dinilud
ID: 21852655
set 'customer_link' as autoincement field
0
 

Author Comment

by:ubernewb
ID: 21852904
Hi dinilud,

It kind of answers the question about inserting new values into the sql table but not really on the update, any suggestions?
0
 
LVL 10

Accepted Solution

by:
dinilud earned 500 total points
ID: 21853878
Insert (Assume customer_link is autoinc field)
=====
   INSERT INTO tbl (customername,customerref,website)
                Values('xxxxx','yyyyy','zzzzz')    //automatically added customer_link
   customer_link= Get Last Insered ID; //In MySQL 'SELECT LAST_INSERT_ID()'

Update
=======
   UPDATE tbl SET customername='xxxx1',customerref='yyyy1',website='zzzz1'
         WHERE customer_link=10

In my program, i managed like this. I don't know whether there is any problem.

Any way wait for other Experts.
0
 

Author Closing Comment

by:ubernewb
ID: 31469999
Thanks for your help
0

Featured Post

Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Press three keys together and trigger a function 3 56
Unable to start eclipse ? 17 141
CKEditor - will not function 7 70
Twebbrowser add css to the header 3 24
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…
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…
THe viewer will learn how to use NetBeans IDE 8.0 for Windows to perform CRUD operations on a MySql database.
The viewer will learn how to synchronize PHP projects with a remote server in NetBeans IDE 8.0 for Windows.

786 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