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
Solved

How do I create an SQL query to save changes in my database?

Posted on 2007-11-23
3
250 Views
Last Modified: 2010-04-23
I have a database table called table1 which I have loaded into a visual basic program. When I dragged the icon from the data sources window to the form and created the datagrid, a toolbar was created with a save button on. However, when I click it to save changes, the changes are not actually saved.

I navigated to the properties of my tableadapter and found that the updatecommand box was empty (so I assume the update command does nothing when called in a program).

What would I need to put in a new query to save changes to my database? It only has 2 columns: Episode and Rating.

Thanks
0
Comment
Question by:BIGZIPZ1
3 Comments
 
LVL 16

Expert Comment

by:SQL_SERVER_DBA
ID: 20341518
just add an index to the table, make it a unique key.
0
 

Author Comment

by:BIGZIPZ1
ID: 20341651
But the updatecommand field is empty in the properties. I must have deleted it when I was trying to get it to work. If the field is empty then when I do tableadapter.update it will execute an empty command right?
0
 
LVL 3

Accepted Solution

by:
ScottParker earned 500 total points
ID: 20341765
You will probably have to start over.

First add a Unique key to your table like suggested by the previous person,
then go back though the steps and you will end up with something like the following in your forms code..

    Private Sub PendingeventsBindingNavigatorSaveItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles PendingeventsBindingNavigatorSaveItem.Click
        Me.Validate()
        Me.PendingeventsBindingSource.EndEdit()
        Me.PendingeventsTableAdapter.Update(Me.Sh_galaxy1DataSet.pendingevents)

    End Sub
0

Featured Post

Free Tool: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

It’s quite interesting for me as I worked with Excel using vb.net for some time. Here are some topics which I know want to share with others whom this might help. First of all if you are working with Excel then you need to Download the Following …
The ECB site provides FX rates for major currencies since its inception in 1999 in the form of an XML feed. The files have the following format (reducted for brevity) (CODE) There are three files available HERE (http://www.ecb.europa.eu/stats/exch…
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…

840 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