- Joined
- May 2, 2007
- Messages
- 574
- Reaction score
- 3
Hello, I'm creating a program on VB6 (Don't slander me, I enjoy using it and it's for personal use) and I'm trying to update a record using 2 WHERE clauses.
My records are set out like
As you can see I have 2 things with the name "a"
I have 2 ListBoxes. 1 visible (Showing 'name') and one hidden (Showing 'ID'). When I click the visible listbox, the ListIndex transfers over the the second listbox so when I click the name in the first list box, the correct ID is selected in the hidden listbox.
My query I'm running to update is
However is is ignoring the second WHERE clause and replacing both items named a.
Is there any way of getting around this?
My records are set out like
Code:
|---------|---------|---------|---------|
|----ID---|---Name--|---Cost--|Quantity-|
|---------|---------|---------|---------|
|----1----|----a----|----1----|---10----|
|----2----|----a----|----1----|----1----|
|----3----|----b----|----1----|----3----|
|----4----|----c----|----2----|----5----|
|---------|---------|---------|---------|
As you can see I have 2 things with the name "a"
I have 2 ListBoxes. 1 visible (Showing 'name') and one hidden (Showing 'ID'). When I click the visible listbox, the ListIndex transfers over the the second listbox so when I click the name in the first list box, the correct ID is selected in the hidden listbox.
My query I'm running to update is
Code:
rs.Open "UPDATE items SET cost='" + txtCost.Text + "', quantity='" + txtQuant.Text + "' WHERE name='" + ListBox1.Text + "' AND id='" + ListBox2.Text + "'"
However is is ignoring the second WHERE clause and replacing both items named a.
Is there any way of getting around this?