0

I'm creating an inventory system which should display the products that needs to be restock. If the quantity of the product is only 10 it should display a message that says you need to restock now. But I don't know how to do that I'm sorry, hope u guys understand.

here's my table
http://imgur.com/jpjLYVy

2
Contributors
2
Replies
10
Views
2 Years
Discussion Span
Last Post by Shark_1
0
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        MysqlConn = New MySqlConnection
        MysqlConn.ConnectionString = "server=localhost;userid=root;password=root;database=taihsin_inventory"
        Dim Reader As MySqlDataReader
        Try
            MysqlConn.Open()
            Dim query As String
            query = "select quantiy from taihsin_inventory where quantiy < 100"
            COMMAND = New MySqlCommand(query, MysqlConn)
            Reader = COMMAND.ExecuteReader
            While Reader.Read
                MessageBox.Show("Following products quantity is less than 100\n"+
            End While
        Catch ex As Exception

        End Try
        where my current code.
0

There are some mistakes in conception to read data from datareader object. If the reader contains no data it can't give you any result. So, you have to check first it contains any record or not.
The codes should be

MysqlConn = New MySqlConnection
        MysqlConn.ConnectionString = "server=localhost;userid=root;password=root;database=taihsin_inventory"
        Dim Reader As MySqlDataReader
        Try
            MysqlConn.Open()
            Dim query As String
            query = "select quantiy from taihsin_inventory where quantiy < 10"
            Dim COMMAND As MySqlCommand= New MySqlCommand(query, MysqlConn)
            Reader = COMMAND.ExecuteReader()
            If Reader.HasRows() Then
                Do Reader.Read()
                    MessageBox.Show("Following products quantity is less than 100\n"+
                Loop
            End If
            Reader.Close()
            Reader.Dispose()
            COMMAND.Dispose()
        Catch ex As Exception
        End Try

Hope, it can help you.

Edited by Shark_1

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.