Hi,
Does anyone know why I keep getting this error?
Thanks in advance
Does anyone know why I keep getting this error?
Code:
Private Sub ComboBox1_SelectionChangeCommitted(ByVal sender As Object, ByVal e As System.EventArgs) Handles ComboBox1.SelectionChangeCommitted
Try
'Display recipe details when a meal is selected from the list
'get its index value
Dim IntNum As Integer = ComboBox1.SelectedValue
Dim dsRecipe As New DataSet
'find it in the database and get the receipe
Dim sql As String = "SELECT Recipes.RecipeNumber, Recipes.Time, Recipes.Method, Recipes.Serves FROM Recipes WHERE Recipes.RecipeNumber=" & IntNum & ";"
ConnectToDataBase()
Dim tablAdaptor As New OleDb.OleDbDataAdapter(sql, dbConnection)
'store the recipe
tablAdaptor.Fill(dsRecipe, "RecipeText")
'display the recipe on screen
RecipeTitle1.DataBindings.Add("Text", dsRecipe, "Recipes.RecipeName")
Dim RecipeText As String = "Time" & vbCrLf & dsRecipe.Tables("Recipes").Rows(0).Item(1) _
& vbCrLf & vbCrLf & "Method:" & vbCrLf & dsRecipe.Tables("Recipes").Rows(0).Item(2) _
& vbCrLf & vbCrLf & "Serves:" & vbCrLf & dsRecipe.Tables("Recipes").Rows(0).Item(3)
RecipeTextBox.Text = RecipeText
Catch ex As Exception
MsgBox(Err.Description)
End Try
End Sub