Solved

Visual Studio 2008 SQL data source

Posted on 2012-04-02
4
332 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
ID: 37796531
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
ID: 37796546
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
ID: 37796604
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
ID: 37797840
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
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.
Are you ready to implement Active Directory best practices without reading 300+ pages? You're in luck. In this webinar hosted by Skyport Systems, you gain insight into Microsoft's latest comprehensive guide, with tips on the best and easiest way…

735 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