I have the following structure:
Mycode:
PrivateSubCarregaEstoque()UsingconAsOleDbConnection=GetConnection()Trycon.Open()DimsqlAsString="SELECT IdProduto, Descricao, (SELECT SUM(Entradas.QtdEntrada) FROM Entradas WHERE Entradas.IdProduto = Produtos.IdProduto) - " & _
"(SELECT SUM(Saidas.QtdSaida) FROM Saidas WHERE Saidas.IdProduto = Produtos.IdProduto) AS Diferenca FROM Produtos"
Dim cmd As OleDbCommand = New OleDbCommand(sql, con)
Dim da As OleDbDataAdapter = New OleDbDataAdapter(cmd)
Dim dt As DataTable = New DataTable
da.Fill(dt)
DataGridView1.DataSource = dt
Catch ex As Exception
MsgBox(ex.Message)
End Try
con.Close()
End Using
End Sub
How to return the quantity of product 02, and had no outputs related to this?