Update SQL db with button
This one should be easy for the .NET mavens.
I have an ASP.NET web page tied to a SQL database. One of the fields in the SQL database is a bit field called "Marked" and determines whether or not a database item is marked for deletion.
I've got two Gridviews on the page. The top is a list of all the items in the database that aren't Marked for deletion, and the bottom gridview is a list of items that have been marked for deletion.
I want the user to be able to click a Delete button next to an item in the top list and "send" that item to the bottom list, where an Undo button could send it back to the top list. The idea is just to make any deleted item visible to (and restorable by) the user until the user clicks a button that deletes all marked items.
So I want the Delete button to change the item's Marked attribute from False to True, and the Undo button to change it back from True to False.
I assume the way to do this is to make the Delete button a Template field, then edit the VB code so a click of the button issues a command to update the item's Marked field in the database. But...I don't really know how to do that!
What code should the Delete button's onclick sub contain to accomplish this? Can anyone give me an example or point me to some examples?
I'm not married to doing it this way, of course, if there's a better/easier way to do it.
Thanks in advance for any help!
Okay, I was making it more complicated than it had to be. I realized I didn't have to do the Update programmatically; I could configure it in the SqlDataSource for the top gridview.
But now I have another problem:
When I click the Delete button now, its "Marked" field is changed to "True" in the database, as it should be. And the deleted item disappears from the top Gridview, as it should, since the top Gridview's data source is configured to return only items whose "Marked" field is "False." But it's not appearing in the second Gridview, which is configured to show all items whose "Marked" field is "True."
It appears the second gridview is not refreshing when I click the "Delete" button in the top gridview. Is this because the two gridviews use separate data sources? How can I get the second gridview to update with the top one?
Can't possible guess without seeing code.
But the separate data sources shouldn't matter. If the page is refreshing, the query should refresh, and it should pick up the altered records.
Update SQL db with button
Im going to guess that the idea is that a user enters the first and last names into your text boxes, then clicks a command button and Access looks up the rest of the information contained in contacttable.
Why not use a combo box and let Access look up the information based on that, without having to press a command button? The Wizard would guide you through it.
Donkey: You replied to a thread that is almost 3 years old. And did you not notice that the 2 posts in this thread are the only ones made by refriedwhiskey? He will never see your answer.