Solved

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

Posted on 2007-11-23
3
252 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
[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 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

Ransomware: The New Cyber Threat & How to Stop It

This infographic explains ransomware, type of malware that blocks access to your files or your systems and holds them hostage until a ransom is paid. It also examines the different types of ransomware and explains what you can do to thwart this sinister online threat.  

Question has a verified solution.

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

Introduction: When running hybrid database environments, you often need to query some data from a remote db of any type, while being connected to your MS SQL Server database. Problems start when you try to combine that with some "user input" pass…
Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
This video Micro Tutorial shows how to password-protect PDF files with free software. Many software products can do this, such as Adobe Acrobat (but not Adobe Reader), Nuance PaperPort, and Nuance Power PDF, but they are not free products. This vide…
Add bar graphs to Access queries using Unicode block characters. Graphs appear on every record in the color you want. Give life to numbers. Hopes this gives you ideas on visualizing your data in new ways ~ Create a calculated field in a query: …

724 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