Click here to Skip to main content
15,881,882 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
VB.NET
Imports System.Data.OleDb
Public Class MainSeller
    Dim cnn As New OleDb.OleDbConnection
    Dim cmdDelete As New OleDb.OleDbCommand
    Dim cnnOLEDB As New OleDb.OleDbConnection
    Dim cmdInsert As New OleDb.OleDbCommand
    Dim cmdUpdate As New OleDb.OleDbCommand
    Dim strConnectionString = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" &
     System.Environment.CurrentDirectory & "\InventSystem.accdb"
    Public Sub RefreshData()
        If Not cnn.State = ConnectionState.Open Then
            'open connection
            cnn.Open()
        End If

        Dim da As New OleDb.OleDbDataAdapter("SELECT Barcode, " & _
                                          "ItemName as [Item Name], ItemDescription, Quantity, TotalPrice " & _
                                          " FROM ReceiptDetails ORDER BY ReceiptID", cnn)
        Dim dt As New DataTable
        'fill data to datatable
        da.Fill(dt)

        'offer data in data table into datagridview
        Me.DataGridView1.DataSource = dt

        'close connection
        cnn.Close()
        'DataGridView1.DataSource = ds.Tables(0)
    End Sub


What I have tried:

I was just wondering what code i am going to use for out of stock, I am new to this so please help
Posted
Updated 19-Oct-16 20:49pm

If using ReceiptDetails to keep track of stock on hand then Quantity = 0 for out of stock.
 
Share this answer
 
Comments
CaptainChizni 20-Oct-16 2:43am    
can you show me the code?
Create another form and replicate everything but change the SQL statement and add a WHERE clause like this.

"SELECT Barcode, ItemName as [Item Name], ItemDescription, Quantity, TotalPrice FROM ReceiptDetails
WHERE Quantity = 0
ORDER BY ReceiptID"
 
Share this answer
 
Comments
CaptainChizni 20-Oct-16 4:57am    
It Works thank you

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900