ボタンのクリックに基づいて、アクセスデータベースから特定のデータを表示する方法を見つけようとしています。たとえば、[在庫] ボタンをクリックすると、在庫切れのデータベースのアイテムが表示されます。接続を開いてクエリ情報を表示することはできますが、LINQ クエリが長く、どこから来たのかわかりません。データベース情報を表示する方法について何か提案はありますか? 例:顧客情報、在庫品など...
Option Strict On
Imports System.Data.OleDb
Public Class frmMicroland
Dim con As New OleDbConnection
Private Sub btnStockItems_Click(sender As System.Object, e As System.EventArgs) Handles btnStockItems.Click
Dim query1 = From anyOrder In MICROLANDDataSet.Orders
Join itsStockItem In MICROLANDDataSet.Inventory
On anyOrder.itemID Equals itsStockItem.itemID
Let orderQuantity = anyOrder.quantity
Select itsStockItem.quantity, itsStockItem.description, anyOrder.itemID
Order By quantity, itemID
''Test connection to make sure it opens first
Try
con = New OleDb.OleDbConnection("provider= microsoft.ace.oledb.12.0;Data Source = C:\Users\HPG62-220US\Documents\Visual Studio 2010\Projects\Asignment 9\Asignment 9\bin\Debug\MICROLAND.accdb; Persist Security Info=False;")
Try
Call con.Open()
Catch ex As Exception
MessageBox.Show("Could not connect")
End Try
If con.State = ConnectionState.Open Then
MessageBox.Show("Connection is open")
End If
Catch ex As Exception
End Try
lstOutput.Items.Add("Here are the items that are out of")
lstOutput.Items.Add("inventory or must be reordered.")
lstOutput.Items.Add("")
lstOutput.Items.Add("The numbers shown give the")
lstOutput.Items.Add("minimum reorder quantity required.")
lstOutput.Items.Add("")
lstOutput.Items.Add(query1)
con.Close()
End Sub
Private Sub btnTodaysOrders_Click(sender As System.Object, e As System.EventArgs) Handles btnTodaysOrders.Click
End Sub
End Class