So far I'am using this code.
The problem is it loads too slow when it is loading on my textbox, is there another way around it? I was just looking for suggestions or ideas. Thank you.

 Function qtyCheck()


        query = "SELECT SUM(prdInput) AS prdInput FROM ProdOutput WHERE HELPER ='" & txtLot.Text & "-" & txtPartNumber.Text & "-" & txtProcess1.Text & "';"
        retrieveSingleResult(query)

        proc1QTYIn.Text = dt.Rows(0)("prdInput").ToString()

        query = "SELECT SUM(prdOutput) AS prdOutput FROM ProdOutput WHERE HELPER ='" & txtLot.Text & "-" & txtPartNumber.Text & "-" & txtProcess1.Text & "';"
        retrieveSingleResult(query)

        proc1QTYOut.Text = dt.Rows(0)("prdOutput").ToString()
        '/
        query = "SELECT SUM(prdInput) AS prdInput FROM ProdOutput WHERE HELPER ='" & txtLot.Text & "-" & txtPartNumber.Text & "-" & txtProcess2.Text & "';"
        retrieveSingleResult(query)

        proc2QTYIn.Text = dt.Rows(0)("prdInput").ToString()

        query = "SELECT SUM(prdOutput) AS prdOutput FROM ProdOutput WHERE HELPER ='" & txtLot.Text & "-" & txtPartNumber.Text & "-" & txtProcess2.Text & "';"
        retrieveSingleResult(query)

        proc2QTYOut.Text = dt.Rows(0)("prdOutput").ToString()
        '/
        query = "SELECT SUM(prdInput) AS prdInput FROM ProdOutput WHERE HELPER ='" & txtLot.Text & "-" & txtPartNumber.Text & "-" & txtProcess3.Text & "';"
        retrieveSingleResult(query)

        proc3QTYIn.Text = dt.Rows(0)("prdInput").ToString()

        query = "SELECT SUM(prdOutput) AS prdOutput FROM ProdOutput WHERE HELPER ='" & txtLot.Text & "-" & txtPartNumber.Text & "-" & txtProcess3.Text & "';"
        retrieveSingleResult(query)

        proc3QTYOut.Text = dt.Rows(0)("prdOutput").ToString()
        '/
        query = "SELECT SUM(prdInput) AS prdInput FROM ProdOutput WHERE HELPER ='" & txtLot.Text & "-" & txtPartNumber.Text & "-" & txtProcess4.Text & "';"
        retrieveSingleResult(query)

        proc4QTYIn.Text = dt.Rows(0)("prdInput").ToString()

        query = "SELECT SUM(prdOutput) AS prdOutput FROM ProdOutput WHERE HELPER ='" & txtLot.Text & "-" & txtPartNumber.Text & "-" & txtProcess4.Text & "';"
        retrieveSingleResult(query)

        proc4QTYOut.Text = dt.Rows(0)("prdOutput").ToString()
        '/
        query = "SELECT SUM(prdInput) AS prdInput FROM ProdOutput WHERE HELPER ='" & txtLot.Text & "-" & txtPartNumber.Text & "-" & txtProcess5.Text & "';"
        retrieveSingleResult(query)

        proc5QTYIn.Text = dt.Rows(0)("prdInput").ToString()

        query = "SELECT SUM(prdOutput) AS prdOutput FROM ProdOutput WHERE HELPER ='" & txtLot.Text & "-" & txtPartNumber.Text & "-" & txtProcess5.Text & "';"
        retrieveSingleResult(query)

        proc5QTYOut.Text = dt.Rows(0)("prdOutput").ToString()
        '/
        query = "SELECT SUM(prdInput) AS prdInput FROM ProdOutput WHERE HELPER ='" & txtLot.Text & "-" & txtPartNumber.Text & "-" & txtProcess6.Text & "';"
        retrieveSingleResult(query)

        proc6QTYIn.Text = dt.Rows(0)("prdInput").ToString()

        query = "SELECT SUM(prdOutput) AS prdOutput FROM ProdOutput WHERE HELPER ='" & txtLot.Text & "-" & txtPartNumber.Text & "-" & txtProcess6.Text & "';"
        retrieveSingleResult(query)

        proc6QTYOut.Text = dt.Rows(0)("prdOutput").ToString()
        '/
        query = "SELECT SUM(prdInput) AS prdInput FROM ProdOutput WHERE HELPER ='" & txtLot.Text & "-" & txtPartNumber.Text & "-" & txtProcess7.Text & "';"
        retrieveSingleResult(query)

        proc7QTYIn.Text = dt.Rows(0)("prdInput").ToString()

        query = "SELECT SUM(prdOutput) AS prdOutput FROM ProdOutput WHERE HELPER ='" & txtLot.Text & "-" & txtPartNumber.Text & "-" & txtProcess7.Text & "';"
        retrieveSingleResult(query)

        proc7QTYOut.Text = dt.Rows(0)("prdOutput").ToString()
        '/
        query = "SELECT SUM(prdInput) AS prdInput FROM ProdOutput WHERE HELPER ='" & txtLot.Text & "-" & txtPartNumber.Text & "-" & txtProcess8.Text & "';"
        retrieveSingleResult(query)

        proc8QTYIn.Text = dt.Rows(0)("prdInput").ToString()

        query = "SELECT SUM(prdOutput) AS prdOutput FROM ProdOutput WHERE HELPER ='" & txtLot.Text & "-" & txtPartNumber.Text & "-" & txtProcess8.Text & "';"
        retrieveSingleResult(query)

        proc8QTYOut.Text = dt.Rows(0)("prdOutput").ToString()
        End Function

Use a UNION to combine all queries into one, then process each returned record.

commented: Thanks mate. Will try it +0

And please look into parameterized queries. The way you are doing it leaves you open to SQL injection attacks. You might as well learn to do it the safe way now. Bad habits are hard to unlearn.

Malpractice makes malperfect.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.