Winston Smith
asked on
Why do i get this value returned
Hi All.
Programming in VS.NET using VB.NET Windows Forms
Have the following code on a combobox (call it the parent)
Private Sub adRE_cmbRaceName_SelectedI ndexChange d(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles adRE_cmbRaceName.SelectedI ndexChange d
LoadDate()
End Sub
it calls this function to load the 'child' combobox with values from the DB
Private Function LoadDate() As Integer
Dim myDS As New DataSet
Dim cnn As SqlConnection = New SqlConnection(ClientConnSt ring)
Dim myCommand As SqlCommand = New SqlCommand("Select RaceDate from race_event where RaceID = " & adRE_cmbRaceName.SelectedV alue, cnn)
myCommand.CommandType = CommandType.Text
cnn.Open()
Dim myDataAdapter As SqlDataAdapter = New SqlDataAdapter(myCommand)
Try
myDataAdapter.Fill(myDS, "Date")
Catch
MsgBox("Error updating database. Error number: " & Err.Number & ": Description: " & Err.Description, MsgBoxStyle.Exclamation, "Database Error")
End Try
cnn.Close()
adRE_cmbRaceDate.DataSourc e = myDS.Tables(0)
adRE_cmbRaceDate.DisplayMe mber = "RaceDate"
End Function
All code works fine but everytime the child combobox is filled with the following text only, 'System.Data.DataRowView'.
Then i move the parent again, it fires the code, and i get the values i want in the child. This happens on all my combo boxes i do on a selectediindexchange trigger so hopefully someone has seen this before as i am pulling my hair out. Won't do to have to tell the user to 'Just twiddle with the drop-downs until the values come out' LOL.
Thanks everyone!!
Programming in VS.NET using VB.NET Windows Forms
Have the following code on a combobox (call it the parent)
Private Sub adRE_cmbRaceName_SelectedI
LoadDate()
End Sub
it calls this function to load the 'child' combobox with values from the DB
Private Function LoadDate() As Integer
Dim myDS As New DataSet
Dim cnn As SqlConnection = New SqlConnection(ClientConnSt
Dim myCommand As SqlCommand = New SqlCommand("Select RaceDate from race_event where RaceID = " & adRE_cmbRaceName.SelectedV
myCommand.CommandType = CommandType.Text
cnn.Open()
Dim myDataAdapter As SqlDataAdapter = New SqlDataAdapter(myCommand)
Try
myDataAdapter.Fill(myDS, "Date")
Catch
MsgBox("Error updating database. Error number: " & Err.Number & ": Description: " & Err.Description, MsgBoxStyle.Exclamation, "Database Error")
End Try
cnn.Close()
adRE_cmbRaceDate.DataSourc
adRE_cmbRaceDate.DisplayMe
End Function
All code works fine but everytime the child combobox is filled with the following text only, 'System.Data.DataRowView'.
Then i move the parent again, it fires the code, and i get the values i want in the child. This happens on all my combo boxes i do on a selectediindexchange trigger so hopefully someone has seen this before as i am pulling my hair out. Won't do to have to tell the user to 'Just twiddle with the drop-downs until the values come out' LOL.
Thanks everyone!!
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.