Quantcast
Channel: VBForums - Visual Basic .NET
Viewing all articles
Browse latest Browse all 27349

VS 2010 [RESOLVED] SQL Problem?

$
0
0
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...
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

Thanks in advance..

Viewing all articles
Browse latest Browse all 27349

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>