Can't Update GridView

I have a GridView bound to a SQL Server DataSource.  All the data renders from that souce into the bound grid.  I've made the grid editable, so when I hit "Edit", the one field I want to be edited is enabled.  When I put in the new value and hit update, absolultely nothing happens.

The attached file shows my update query.  There's not much to it.  I map the "Quantity" field in the grid to the "QUantity" field in the database.  When I hit "execute query", the value I put in manually in this window indeed DOES get written to the database.  However, when I update a single row, not only does that value not get written to all rows (as in my test), but nothing gets updated anywhere.

I'm almost there.  What grand avatar can guide me to the ever-elusive grail of actually being able to update a datasource?
Image.jpg
LVL 1
NigelRocksAsked:
Who is Participating?

[Webinar] Streamline your web hosting managementRegister Today

x
 
newbiealConnect With a Mentor Commented:
You have to complete the SQL statement add a where clause, something like:
WHERE some_column=some_value

Otherwise how does it know which record in the db to update?

I believe it works in the query builder, because it knows the record to update (by default the first one in the table, possibly?), but in the gridview it doesn't know.
0
 
NigelRocksAuthor Commented:
I thought of that and added the WHERE clause later.  Still doesn't work.
0
 
NigelRocksAuthor Commented:
The attached image shows my settings in the query window.  What am I missing?
Image.jpg
0
The new generation of project management tools

With monday.com’s project management tool, you can see what everyone on your team is working in a single glance. Its intuitive dashboards are customizable, so you can create systems that work for you.

 
newbiealConnect With a Mentor Commented:
Did you add breakpoints in your code to see if the update event/method(s) are firing at all?
0
 
NigelRocksAuthor Commented:
The actual problem was that I had a DataBind() method being called on postback. This loaded the old data back into the grid.  Once I took it out, the grid was updated without a problem.
0
 
newbiealCommented:
Glad you found the source of the issue and were able to resolve it.
0
All Courses

From novice to tech pro — start learning today.