can anyone help me in this problem? i have to put sql server data in my combobox on my form, i watch several tutorial in youtube and read here some other codes but i still don't how to. please can anyone help me?
Using combocon As New SqlConnection("Data Source=NSSISQLSERVER;Initial Catalog=NSSIDB;Persist Security Info=True;User ID=*******;Password=*****")
combocon.Open()
Dim xcom As String = "Select fldAssignTechnical from tbleRequestHistory"
Dim comcmd As New SqlCommand(xcom, combocon)
comcmd.CommandType = CommandType.Text
Dim datadap As New SqlDataAdapter
Dim dtable As New DataTable
datadap.Fill(dtable)
If dtable.Rows.Count = 0 Then
MsgBox("No Existing List", MsgBoxStyle.Critical)
Else
For i = 0 To dtable.Rows.Count - 1
FldAssignTechnicalComboBox.Items.Add(dtable.Rows(i).Item("FldAssignTechnicalComboBox"))
Next
End If
End Using
FldAssignTechnicalComboBox.SelectedItem = 0
Inline Code Example Here