nicks60610
MIS
I am trying to populate a drop-down based on a query, I have text boxes which I update using the DataFill method, so being the rookie I am, I thought I could do the same for drop downs, but not so...
Const StrConnString As String = "server......="
Dim objConn As New SqlConnection(StrConnString)
Dim cmdSelect2
cmdSelect2 = New SqlCommand("Select * From Kaizen where KaizenID = '" & strID & "' ", objConn)
Dim myDA As SqlDataAdapter = New SqlDataAdapter(cmdSelect2)
Dim myDataSet = New DataSet()
myDA.Fill(myDataSet, "Kaizen")
Dim Row As DataRow
If myDataSet.Tables("Kaizen").Rows.Count > 0 Then
Row = myDataSet.Tables("Kaizen").Rows(0)
End If
If Row.Item("LongDescription") Is DBNull.Value Then
DescrTxt.Text = String.Empty
Else
DescrTxt.Text = Row.Item("LongDescription")
End If
If Row.Item("Status") Is DBNull.Value Then
Status.SelectedItem.Value = String.Empty
Else
Status.SelectedItem.Value = Row.Item("Status")
End If
My code fails on the Status...it does not like that at all, any ideas??
Thanks!
Const StrConnString As String = "server......="
Dim objConn As New SqlConnection(StrConnString)
Dim cmdSelect2
cmdSelect2 = New SqlCommand("Select * From Kaizen where KaizenID = '" & strID & "' ", objConn)
Dim myDA As SqlDataAdapter = New SqlDataAdapter(cmdSelect2)
Dim myDataSet = New DataSet()
myDA.Fill(myDataSet, "Kaizen")
Dim Row As DataRow
If myDataSet.Tables("Kaizen").Rows.Count > 0 Then
Row = myDataSet.Tables("Kaizen").Rows(0)
End If
If Row.Item("LongDescription") Is DBNull.Value Then
DescrTxt.Text = String.Empty
Else
DescrTxt.Text = Row.Item("LongDescription")
End If
If Row.Item("Status") Is DBNull.Value Then
Status.SelectedItem.Value = String.Empty
Else
Status.SelectedItem.Value = Row.Item("Status")
End If
My code fails on the Status...it does not like that at all, any ideas??
Thanks!