473,320 Members | 2,006 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

What sql should be bulild to update or insert in follow case?

Gobindap
Hi, I am using VB2010, I need to update data if it exists in the database and if it does not exists I need to insert. How to do it?
Oct 20 '13 #1

✓ answered by Rabbit

Depending on what SQL DBMS you're using, there may be merge type statement you can use. I don't know which one you're using so I can't tell you if it has one.

Otherwise, you can do a count to see if there is a record and run the appropriate insert or update.

3 1147
Rabbit
12,516 Expert Mod 8TB
Depending on what SQL DBMS you're using, there may be merge type statement you can use. I don't know which one you're using so I can't tell you if it has one.

Otherwise, you can do a count to see if there is a record and run the appropriate insert or update.
Oct 21 '13 #2
Thanks for your kind support.

That problem has been solved now. I tried first to insert and then to update, it worked successfully.

Now I have another problem that is, how to refresh one opened form from another form? I tried to reload, call Form_Load but the result was null.

Please help me.
Oct 24 '13 #3
Rabbit
12,516 Expert Mod 8TB
We only allow one question per thread on the forum. Please create a new thread for your new question.
Oct 24 '13 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

5
by: jn | last post by:
I have a page that shows info from MySQL. It is for an online education site. It uses different classes arranged in a hierarchy. Each lesson is roughly laid out like this: Lesson |-Intro |...
2
by: Jenny | last post by:
Hi! I wonder how to use conditions in the inserted table(in a insert/update) trigger? The inserted table contain all the rows that have been updated or inserted (for an update/insert trigger),...
1
by: Lisa | last post by:
I have an asp.net website with an Access Database that works great on my local server, but when I migrated to our production server, none of my sql processes works (i.e update, insert, delete) Does...
1
by: luna | last post by:
trying to create an update/insert button basically if the record exists in the database i want to do an update if it doesnt exist i want to create a new record using insert all using the same...
2
by: Daniel | last post by:
update/insert with microsoft.xml.xquery(.net2.0beta) can anyone provide an example of how to update/insert with microsoft.xml.xquery?
12
by: rAinDeEr | last post by:
Hi, I have a table with 2 columns ** CREATE TABLE test (emp_num DECIMAL(7) NOT NULL,emp_name CHAR(10) NOT NULL) and i have inserted a number of records. ** Now, I want to insert a new...
0
by: dev | last post by:
Hi Everyone, I'm a little confused with the .NET 2.0 BindingSource for WinForms. Is it possible to update, insert or delete database items through the BindingSource with a Typed data object as its...
6
by: kareemaffan | last post by:
Hello Everyone I want to insert values into MS Access database through VB.NET in Visual Studio 2005 . I have used the following code which is not working. Private Sub Button2_Click(ByVal sender...
1
by: sridhar4554 | last post by:
How to give a grant like select,update,insert on a single table i had tried with the command grant eg:GRANT SELECT,INSERT,UPDATE ON DTS_OUTBOX_QUEUE TO sanpapps@dap1 IDENTIFIED BY 'disable';...
0
by: mwenz | last post by:
I am trying to update an Access table using OLEDB in VB.Net 2005. I can add rows but I cannot update them. Code to instantiate the Access database and table... Dim conn As New...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.