tquereshi22
Member
- Joined
- Apr 20, 2007
- Messages
- 8
- Programming Experience
- Beginner
Hi all i am having problem working with datagridview. I am creating a Point of sale system and basically i created a text box and a button. When i type in a product id and hit the button, the datagridview will return the name of the item and the price. The problem is when i typed in 2 for product id 2, the product id 1 is still added to the list, even when i leave the field blank it still does the same thing? how do i solve this problem?
Private Sub cmdGo_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles cmdGo.Click
da.SelectCommand = cmd
da.SelectCommand.Parameters.AddWithValue("@ProductID", txtInv.Text)
da.Fill(ds)
DataGridView1.DataSource = ds.Tables(0)
End Sub
Private Sub POSForm3_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
da.SelectCommand = cmd
da.SelectCommand.Parameters.AddWithValue("@ProductID", "*")
da.Fill(ds)
DataGridView1.DataSource = ds.Tables(0)
ds.Tables(0).Rows.Clear()
End Sub
Another question is how do i calculate the total of the price in the datagridview and also how do i when i click on save transaction the quantity of an item from the database; QOH will be from 24 to 22 if 2 chocolate for example was bought.
Please help as i need to get this done as soon as possible. Some coding would be nice to give me an idea of how the whole thing works.
Jon
Oh one more thing im using vb 2005 and ms access
Private Sub cmdGo_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles cmdGo.Click
da.SelectCommand = cmd
da.SelectCommand.Parameters.AddWithValue("@ProductID", txtInv.Text)
da.Fill(ds)
DataGridView1.DataSource = ds.Tables(0)
End Sub
Private Sub POSForm3_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
da.SelectCommand = cmd
da.SelectCommand.Parameters.AddWithValue("@ProductID", "*")
da.Fill(ds)
DataGridView1.DataSource = ds.Tables(0)
ds.Tables(0).Rows.Clear()
End Sub
Another question is how do i calculate the total of the price in the datagridview and also how do i when i click on save transaction the quantity of an item from the database; QOH will be from 24 to 22 if 2 chocolate for example was bought.
Please help as i need to get this done as soon as possible. Some coding would be nice to give me an idea of how the whole thing works.
Jon
Oh one more thing im using vb 2005 and ms access