Imports System.Data.OleDb Imports System.Configuration Public Class Ch11Products Inherits System.ComponentModel.Component #Region " Component Designer generated code " Public Sub New(ByVal Container As System.ComponentModel.IContainer) MyClass.New() 'Required for Windows.Forms Class Composition Designer support Container.Add(Me) End Sub Public Sub New() MyBase.New() 'This call is required by the Component Designer. InitializeComponent() 'Add any initialization after the InitializeComponent() call End Sub 'Component overrides dispose to clean up the component list. Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean) If disposing Then If Not (components Is Nothing) Then components.Dispose() End If End If MyBase.Dispose(disposing) End Sub 'Required by the Component Designer Private components As System.ComponentModel.IContainer 'NOTE: The following procedure is required by the Component Designer 'It can be modified using the Component Designer. 'Do not modify it using the code editor. Private Sub InitializeComponent() End Sub #End Region Dim CS As String = _ "Data Source=" & _ "C:\Inetpub\wwwroot\Chapter11WebService\data\TaraStore.mdb;" & _ "Provider=Microsoft.Jet.OLEDB.4.0" Dim OleDbConnection1 As New OleDbConnection(CS) Public Function GetCat() As DataSet Dim MySQL As String = "SELECT * FROM Categories" Dim objCM1 As New OleDbDataAdapter(MySQL, OleDbConnection1) Dim objDS1 As New DataSet objCM1.Fill(objDS1, "Categories") Return objDS1 End Function Public Function GetSubCats(ByVal CatID As Integer) As DataSet Dim MySQL As String = "SELECT * FROM SubCategories WHERE CategoryID = " & CatID Dim objCM2 As New OleDbDataAdapter(MySQL, OleDbConnection1) Dim objDS2 As New DataSet objCM2.Fill(objDS2, "SubCategories") Return objDS2 End Function Public Function GetProducts(ByVal SubCatID As Integer) As DataSet Dim MySQL As String = "SELECT * FROM Products WHERE SubCategoryID = " & SubCatID Dim objCM3 As New OleDbDataAdapter(MySQL, OleDbConnection1) Dim objDS3 As New DataSet objCM3.Fill(objDS3, "Products") Return objDS3 End Function Public Function GetProduct(ByVal ProdID As Integer) As DataSet Dim MySQL As String = "SELECT * FROM Products WHERE ProductID = " & ProdID Dim objCM4 As New OleDbDataAdapter(MySQL, OleDbConnection1) Dim objDS4 As New DataSet objCM4.Fill(objDS4, "Products") Return objDS4 End Function End Class