hi i have 4 DropDownList
i made connction with database sql server 2008
and create 2 button NEW , SAVE button
here funtion to DropDown
Protected Sub DropDownList_Init(ByVal sender As Object, ByVal e As System.EventArgs) Handles RadComboBox6.Init
If flagNEW <> "NEW" Then
Dim adapter As New SqlDataAdapter("SELECT ID,DESCR , ACCT_NO,MAISTAKE_ID FROM HAL_HR_PENALTY_TAP ", con)
Dim links As New DataTable()
adapter.Fill(links)
RadComboBox6.DataTextField = "ID"
RadComboBox6.DataValueField = "ID"
'TextBox6.Text = flagNEW
RadComboBox6.DataSource = links
RadComboBox6.DataBind()
End If
End Sub
when i click new i make empty DropDown i fill data DropDownList
and when i click save
con.Close()
con.Open()
Dim cmd As SqlCommand
cmd = New SqlCommand("insert into HAL_HR_PENALTY_TAP (ID,DESCR,MAISTAKE_ID,ACCT_NO) VALUES (@ID,@DESCR,@MAISTAKE_ID,@ACCT_NO)", con)
Dim pr1 As New SqlParameter
pr1 = cmd.Parameters.Add("@ID", SqlDbType.VarChar)
pr1.Value = RadComboBox6.Text
pr1 = cmd.Parameters.Add("@DESCR", SqlDbType.VarChar)
pr1.Value = RadComboBox7.Text
pr1 = cmd.Parameters.Add("@MAISTAKE_ID", SqlDbType.VarChar)
pr1.Value = Left(RadComboBox8.Text, 2)
pr1 = cmd.Parameters.Add("@ACCT_NO", SqlDbType.VarChar)
pr1.Value = RadComboBox9.Text
'con.Open()
cmd.ExecuteNonQuery()
MsgBox("تم الحفظ")
it saved but the problem the data not back when i DropDownList
give me empty List how i refrish data in DropDownList after save