how to deduct qty from data base
i have used this sentex to deduct......

 cm1.CommandText = "update inventory set qty=qty- " & cust_gv.Rows(i).Cells(3).Value() & " where item_name='" & cust_gv.Rows(i).Cells(1).Value() & "'"

this sentex is giveing error

Recommended Answers

All 6 Replies

What do you mean "deduct"?
Do you want to:
1) change the value by subtracting another value or
2) delete the value or
3) delete the row?

hmm.. row(i).. i think it's not specific, how if you use CurrentRow?

i have a data grid view in which there is category , item name ,rate , qty,total.
the qty of that particular item name has to be deducted (minus) from the current qty from inventory(inventory is a database)

Row(i) can be used in a loop, so I don't think that has to be the problem.
Can you debug.print or just messagebox cm1.CommandText and let us know the actual statement you try to execute. Also the actual error might help.

@adam sure it can do with loop, i didn't said it can't

qty=qty-

Then maybe all you need to do is change the element above to:

qty=
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.