Solved

Visual Studio 2008 SQL data source

Posted on 2012-04-02
4
320 Views
Last Modified: 2012-04-12
I have a SELECT statement that selects 4 different fields from a SQL Data Source in Visual Studio 2008.  What I would like to be able to do is execute an UPDATE statement on 3 other, different fields that are in the same table as the SELECT statement, but fields that are not in the SELECT statement.  I can't find out how to accomplish this.
0
Comment
Question by:zintech
  • 2
4 Comments
 
LVL 44

Expert Comment

by:AndyAinscow
Comment Utility
To update a table you need an update statement, not a select statement.  eg.:
UPDATE [TableNameGoesHere] SET Col1 = "xxx", Col2 = "yyyy" WHERE (UniqueIndexOrKeyFieldNameGoesHere=1)
0
 

Author Comment

by:zintech
Comment Utility
I understand that.  I have an SQLDataSource attached to a GridView on the page that displays the fields and data form the datasource on the gridview and when the user clicks 'Edit' and then 'Update' on the Gridview I would like the UPDATE statement form the DataSource to run.  The SQL DataSource only gives the option to add Parameters to the query from the SELECT statement
0
 
LVL 44

Expert Comment

by:AndyAinscow
Comment Utility
You need to fill the UpdateCommand of the gridview with the sql update command you want to execute
0
 
LVL 19

Accepted Solution

by:
Manoj Patil earned 500 total points
Comment Utility
0

Featured Post

Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

Join & Write a Comment

Many of us here at EE write code. Many of us write exceptional code; just as many of us write exception-prone code. As we all should know, exceptions are a mechanism for handling errors which are typically out of our control. From database errors, t…
International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
Internet Business Fax to Email Made Easy - With eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…
In this tutorial you'll learn about bandwidth monitoring with flows and packet sniffing with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're interested in additional methods for monitoring bandwidt…

728 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

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now