Hi,
I have a bit of a problem with my program, which I think might be the SQL.
I'm trying to get all the ingredients for a recipe into a textbox but it's only showing the first ingredient out of about 7.
Could anyone let me know where I'm going wrong.
IntNum is the value of the selected recipe...
Thanks in advance..
I have a bit of a problem with my program, which I think might be the SQL.
I'm trying to get all the ingredients for a recipe into a textbox but it's only showing the first ingredient out of about 7.
Could anyone let me know where I'm going wrong.
IntNum is the value of the selected recipe...
Code:
'find it in the database and get the ingredients
Dim ingredientssql As String = "SELECT Ingredients.IngreID, Ingredients.IngreName, Ingredients.IngreAmount, Ingredients.IngreUnit FROM Ingredients WHERE Ingredients.RecipeNumber=" & IntNum & ";"
'display the ingredients
Dim dsIngredients As New DataSet
ConnectToDataBase()
Dim tableAdaptor As New OleDb.OleDbDataAdapter(ingredientssql, dbConnection)
tableAdaptor.Fill(dsIngredients, "Ingredients")
Dim IngredientsText As String = dsIngredients.Tables("Ingredients").Rows(0).Item(2) _
& dsIngredients.Tables("Ingredients").Rows(0).Item(3) & _
" " & dsIngredients.Tables("Ingredients").Rows(0).Item(1)
IngredientsTextBox.Text = IngredientsText