Inserting data from dropdown menu into sql db in vb .net

I have an vb .net page that has a dropdown menu populated by a SQL table. The table has two fields, one for IDs and the other the ID's descriptions. The table has 12 rows. I've configured the dropdown menu to be populated like so:
            'Populate the drop down menu
            DropDownList3.DataSource = ds_1
            DropDownList3.DataSource = ds_1.Tables(0)
            DropDownList3.DataTextField = ds_1.Tables(0).Columns("ProfessionalType").ColumnName.ToString()
            DropDownList3.DataValueField = ds_1.Tables(0).Columns("ProfessionalTypeId").ColumnName.ToString()
            DropDownList3.DataBind()

However, when I select any ID description from the dropdown menu, the value entered to my custom table is always value 1 which the first value in the ID column.

How can I get the correct ID value inserted into my table when I select any of the ID description from the dropdown menu.

For example,
ID     idtype
1     Sam
2     Joe
3    Jack

When I select Jack from the dropdown menu and run the below command in vb .net
            AddCardioCom_Usr = "EXEC sp_AddCardioCom_Usr '" & TextBox3.Text & "', '" & TextBox4.Text & "','" & TextBox1.Text & "','" & TextBox2.Text & "','" & DropDownList2.SelectedValue & "','" & DropDownList3.SelectedValue & "'"
            Dim dbAddCardioCom_Usr As SqlCommand = New SqlCommand(AddCardioCom_Usr, myconnection_1)

the value inserted in the backend is always 1.

Any suggestions!?
redouardAsked:
Who is Participating?
 
smcdrcConnect With a Mentor Commented:
Have you looked at the source code to see what the drop down values look like and see if they are indeed getting (1,2,3)?

Do something like this to populate the box:

DropDownList3.DataSource = ds_1.Tables(0)
DropDownList3.DataTextField = "ProfessionalType
DropDownList3.DataValueField = "ProfessionalTypeId"
DropDownList3.DataBind()
0
 
razoCommented:
make sure u load ur drowndownlist inside of
if  not ispostback
endif
0
 
redouardAuthor Commented:
I'm sure that the dropdown menu is getting the correct ID values. The only value that its getting the is the first row values which is 1. I select Jack which has an ID value of 3 but in the table after the insert the value is 1 and always 1. I feel that the its not searching the table correctly to get the select ID number. Am I doing any wrong with my code. I made the changes that you suggested. I encountered the same behavior.
0
 
smcdrcCommented:
Are you just using a simple submit type button?
0
All Courses

From novice to tech pro — start learning today.