[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 337
  • Last Modified:

Visual Studio 2008 SQL data source

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
zintech
Asked:
zintech
  • 2
1 Solution
 
AndyAinscowCommented:
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
 
zintechAuthor Commented:
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
 
AndyAinscowCommented:
You need to fill the UpdateCommand of the gridview with the sql update command you want to execute
0
 
Manoj PatilSr. Software EngineerCommented:
0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now