Hi. I'm writing this in VB.Net.
This is the scenario:
A user makes some choices via a couple textboxes and a drop down list.
He or she presses a button.
The button fires a procedure to an SQL Server to call a stored procedure.
Parameters are passed to the stored procedure from the textboxes and the drop down list, as well as some constants.
What is happening is that the values from the drop down list are being taken from the first item in the list--not the selected one. I have this same scenario in another spot in my project, but it works there. I cannot get it to work here and they seem the same. Can anyone offer some help?
Heres the code....Thanks
Private Sub addItems()
'Add an Item
With cmdAddItems
.Connection = conxxx
.CommandType = CommandType.StoredProcedure
.CommandText = "xxxxxx"
With cmdAddItems.Parameters
.Add("@ID", TextBox1.Text)
.Add("@Num", listItems.SelectedItem.Value)
.Add("@Description", listItems.SelectedItem.Text)
.Add("@xxx", "none"
.Add("@Qty", txtQty.Text)
.Add("@Price", 2.5)
End With
End With
cmdAddItems.ExecuteScalar()
End Sub
This is the scenario:
A user makes some choices via a couple textboxes and a drop down list.
He or she presses a button.
The button fires a procedure to an SQL Server to call a stored procedure.
Parameters are passed to the stored procedure from the textboxes and the drop down list, as well as some constants.
What is happening is that the values from the drop down list are being taken from the first item in the list--not the selected one. I have this same scenario in another spot in my project, but it works there. I cannot get it to work here and they seem the same. Can anyone offer some help?
Heres the code....Thanks
Private Sub addItems()
'Add an Item
With cmdAddItems
.Connection = conxxx
.CommandType = CommandType.StoredProcedure
.CommandText = "xxxxxx"
With cmdAddItems.Parameters
.Add("@ID", TextBox1.Text)
.Add("@Num", listItems.SelectedItem.Value)
.Add("@Description", listItems.SelectedItem.Text)
.Add("@xxx", "none"
.Add("@Qty", txtQty.Text)
.Add("@Price", 2.5)
End With
End With
cmdAddItems.ExecuteScalar()
End Sub