Updating or deleting datagrids

Results 1 to 2 of 2

Thread: Updating or deleting datagrids

  1. #1
    Join Date
    Dec 1969

    Default Updating or deleting datagrids

    &nbsp;<BR>Hi all,<BR> I have a shopping cart database and am using a datagrid to do the updating,having the following query string:-<BR> <BR>Dim DeleteCmd As String = "DELETE from Products where id = @Id"<BR> <BR>I could quite alright do the delete but, my problem is, if the same product id is selected different times, the above string deletes every product with that Id but all I wanted is delete the clicked selection. I tried Considering "customer name" in the sql WHERE Clause but it did&#039;nt work. If am not mistaking, it looks like on datagrids, modifications could only be made using the Id column , <BR> <BR>In short, my question is---<BR>On a datagrid, how can I make use of another column that&#039;s not the Id in the sql modification for example:- Select * from tb where name = "strName"<BR> <BR>For the delete or update<BR> <BR>Delete from tb where Id = strId<BR> <BR>

  2. #2
    Join Date
    Dec 1969

    Default RE: Updating or deleting datagrids

    As I understand it, you have a datagrid that lists certain products in a shopping cart fashion. When you delete the product from the shopping cart, you delete that product from all shopping carts? Each entry into the shopping carts should have a key. If you key is a combination of the customer id and the product id, then you should include both in your datagrid. When the update occurs, it only affects that one row. If you don&#039;t want to display a column, set it&#039;s visibility to false (i.e. Visible="False"). If this isn&#039;t your problem, you have to elaborate.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts