Jump to content

[Resolvido] DropdownList


startuga

Recommended Posts

   Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
       If Not IsPostBack Then
           Dim strAreaCod As String = Request.QueryString("AREA_ID")

           DropDownList1.SelectedIndex = strAreaCod

       End If
   End Sub

Protected Sub btn_update_Click(ByVal sender As Object, ByVal e As EventArgs) Handles btn_update.Click

       Dim con As New SqlConnection("Data Source=xxxxxxx;Initial Catalog=xxxxxxx;User ID=xxxxxxx;pwd=xxxxxx")
       con.Open()
       Dim command As New SqlCommand("UPDATE CLUSTERS SET Cluster_ID = @Cluster_ID, Cluster_Name = @Cluster_Name, AREA_ID = @AREA_ID, Cluster_ENABLE = @Cluster_ENABLE FROM CLUSTERS INNER JOIN AREAS ON CLUSTERS.AREA_ID = AREAS.AREA_ID WHERE (CLUSTERS.Cluster_ID = @Cluster_ID)", con)

       command.Parameters.Add("@AREA_ID", SqlDbType.VarChar).Value = DropDownList1.SelectedIndex

       command.ExecuteNonQuery()
       con.Close()
   End Sub
End Class
Edited by ribeiro55
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site you accept our Terms of Use and Privacy Policy. We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.