P
Przemek
Hi,
I've populated my dropdown list from database (category table) via
datatable. It's showing categories in strings. The problem appears,
when I want to add new record to database (entry_table). I'm using
stored procedures and everything works fine until I want to insert
Category ID into entry_table.
I'm getting the selected item from drop down list:
category = myDropDownList.SelectedItem.Value.ToString
and using Select Case statement I'd like to set up valid ID:
Select Case categoryValue
Case categoryValue = "Economy"
category = 1
Case categoryValue = "Politics"
category = 2
End Select
but, string from dropdownlist contains whitespace. I've tried .Trim
function but it didn't work too. Is there any solution for my problem?
Or is there any other way to get back correct IDs?
Przemek
I've populated my dropdown list from database (category table) via
datatable. It's showing categories in strings. The problem appears,
when I want to add new record to database (entry_table). I'm using
stored procedures and everything works fine until I want to insert
Category ID into entry_table.
I'm getting the selected item from drop down list:
category = myDropDownList.SelectedItem.Value.ToString
and using Select Case statement I'd like to set up valid ID:
Select Case categoryValue
Case categoryValue = "Economy"
category = 1
Case categoryValue = "Politics"
category = 2
End Select
but, string from dropdownlist contains whitespace. I've tried .Trim
function but it didn't work too. Is there any solution for my problem?
Or is there any other way to get back correct IDs?
Przemek