Private Sub btnLoad_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnLoad.Click
        Dim sqlconnection As New SqlCeConnection("Data Source = \My Documents\NuttyCafe.sdf; Password = pass1234;")
        Dim sqlSelectTable As SqlCeCommand = sqlconnection.CreateCommand()
        sqlSelectTable.CommandText = "SELECT* FROM Product p inner join Category c on p.categoryID = c.categoryID where p.ProductTitle=@ProductTitle"
        Dim daResult As SqlCeDataAdapter = New SqlCeDataAdapter(sqlSelectTable)
        sqlSelectTable.Parameters.AddWithValue("@ProductTitle", cbxItem.SelectedValue)
        'DataSet will store the result of the SELECT operation
        Dim Result As New DataSet
        daResult.Fill(Result, "ProductABC")
        Dim dtResult As DataTable = Result.Tables("ProductABC")
        If Result.Tables("ProductABC").Rows.Count > 0 Then

            lblPrice.Text = Result.Tables("ProductABC").Rows(0).Item("Price")
            lblShowDesc.Text = Result.Tables("ProductABC").Rows(0).Item("ProductDesc")
            lblShowProID.Text = Result.Tables("ProductABC").Rows(0).Item("ProductID")
            lblShowCat.Text = Result.Tables("ProductABC").Rows(0).Item("CatName")

            PicBox1.Image = New System.Drawing.Bitmap("\program files\Nuttycafe\Images\" + CStr(Result.Tables("Product").Rows(0).Item("ProductImage")))
        End If
    End Sub

    Private Sub MenuItem1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MenuItem1.Click
        frmStaff.Show()
    End Sub

    Private Sub MenuItem3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MenuItem3.Click
        frmNuttyCafe.Show()
    End Sub

    Private Sub MenuItem4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MenuItem4.Click
        frmViewOrder.Show()
    End Sub

    Private Sub MenuItem5_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MenuItem5.Click
        frmEditOrder.Show()
    End Sub

    Private Sub MenuItem6_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MenuItem6.Click
        frmDeleteOrder.Show()
    End Sub
End Class

Edited 6 Years Ago by __avd: Added [code] tags. Encase your code in: [code] and [/code] tags.

Line #18 - Table name would be "ProductABC"

PicBox1.Image = New System.Drawing.Bitmap("\program files\Nuttycafe\Images\" + CStr(Result.Tables("ProductABC").Rows(0).Item("ProductImage")))
This article has been dead for over six months. Start a new discussion instead.