How to Update a DropDownListBox
I want my dropdownlistbox to show the new item just entered from the database once the user clicks the update(save) button. I exactly don't know what is the exact property or method for dropdownlistbox since im a beginner in .Net.
Here is my code to get a better understanding:
Sub SaveNewSubCat(sender as object,e as EventArgs)
Dim strConn as String = "Database=watal;server=Maxood;User id=sa;password=;"
Dim objConn as New SqlConnection(strConn)
Dim cmdInsertSubCat as New SqlCommand("sp_SaveNewSubCat",objConn)
objConn.Open()
cmdInsertSubCat.CommandType = CommandType.StoredProcedure
cmdInsertSubCat.Parameters.Add("@SubCatName",txtNe wSubCat.Text)
cmdInsertSubCat.Parameters.Add("@CatName",cboCat.S electedItem.Text)
cmdInsertSubCat.ExecuteNonQuery()
lblNewSubCat.Visible = "false"
txtNewSubCat.text=""
txtNewSubCat.Visible = "false"
Else
lblNewSubCat.Visible = "false"
txtNewSubCat.text=""
txtNewSubCat.Visible = "false"
End If
End Sub
Could some tell me what to do here?
|