[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
Solved

Insert and update records using a DB Navigator in Delphi

Posted on 2008-06-23
5
Medium Priority
?
2,403 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
[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
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 2000 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

What’s Wrong with Your Cloud Strategy ?

Even as many CIOs are embracing a cloud-first strategy, the reality is that moving to the cloud is a lengthy process and the end-state is likely to be a blend of multiple clouds—public and private. Learn why multicloud solutions matter in this webinar by Nimble Storage.

Question has a verified solution.

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

Jaspersoft Studio is a plugin for Eclipse that lets you create reports from a datasource.  In this article, we'll go over creating a report from a default template and setting up a datasource that connects to your database.
How to install Selenium IDE and loops for quick automated testing. Get Selenium IDE from http://seleniumhq.org Go to that link and select download selenium in the right hand column That will then direct you to their download page. From that p…
The viewer will learn how to use NetBeans IDE 8.0 for Windows to connect to a MySQL database. Open Services Panel: Create a new connection using New Connection Wizard: Create a test database called eetutorial: Create a new test tabel called ee…
The viewer will learn how to use and create keystrokes in Netbeans IDE 8.0 for Windows.
Suggested Courses

656 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