help me pleeeease to update the avaliable quantity column [modified]
-
I'm working on an Access DB and the OLEDB data adapter in a VB.net project, I've a windows form in vb.net called Customers orders (partno,name,orderedquantity) When I fill all the texts with it's data Pay attention to the txt of( the ordered quantity ) ,then I press the oreder button which save the entered data to it's table in the DB. How can I make the (avaliablequantity) column in the other table (parts) updates it's selfe according to the ordered quantity. I made an update query in the Access which update the table just when I click on it here it's( . Please help me how can I make the update process work through the following code of the Customerorders .
Dim as strcon Try Strcon="provider=Microsoft.jet.oledb.4.0;data source=Sales.mdb" Dim con as new oledbconnection(Strcon) Con.open Dim cmd as new oledb command cmd.commandtext=" insert into parts (orderno,partno,orderedquantity)values(" & textbox1.text & "," & textbox2.text & "," & textbox3.text & ")" cmd.executenonqeur con.close catch exp as exception msgbox(exp.tostring) end try
with thanx -- modified at 9:35 Saturday 10th June, 2006 -
I'm working on an Access DB and the OLEDB data adapter in a VB.net project, I've a windows form in vb.net called Customers orders (partno,name,orderedquantity) When I fill all the texts with it's data Pay attention to the txt of( the ordered quantity ) ,then I press the oreder button which save the entered data to it's table in the DB. How can I make the (avaliablequantity) column in the other table (parts) updates it's selfe according to the ordered quantity. I made an update query in the Access which update the table just when I click on it here it's( . Please help me how can I make the update process work through the following code of the Customerorders .
Dim as strcon Try Strcon="provider=Microsoft.jet.oledb.4.0;data source=Sales.mdb" Dim con as new oledbconnection(Strcon) Con.open Dim cmd as new oledb command cmd.commandtext=" insert into parts (orderno,partno,orderedquantity)values(" & textbox1.text & "," & textbox2.text & "," & textbox3.text & ")" cmd.executenonqeur con.close catch exp as exception msgbox(exp.tostring) end try
with thanx -- modified at 9:35 Saturday 10th June, 2006You will need to run another query to update that table "update available_parts set quantity = quantity - " & textbox3.text & " where partno = " & textbox2.text You should really look into using parameterized queries. Also rename textbox1, 2, 3 to something more meaningful.