Imports System.Data.SqlClient
Class Products
Public Shared Function LookupProductsByCategoryId(ByVal CategoryId As Integer) As DataSet
' Create the SQL Connection
Dim DbConnection As New SqlConnection(DBConnect)
' Create the SQL Adapter
Dim DbAdapter As New SqlDataAdapter("EXEC LookupProductsByCategoryId @Id", DbConnection)
' Add SQL Parameters
DbAdapter.SelectCommand.Parameters.Add("@CategoryId", SqlDbType.Int).Value = CategoryId
' Get Result Set
Dim ProductInfo As New DataSet
DbAdapter.Fill(ProductInfo, "ProductInfo")
' Return Result Set
Return ProductInfo
End Function
Public Shared Function LookupAllCategories() As DataSet
' Create the SQL Connection
Dim DbConnection As New SqlConnection(Globals.DBConnect)
' Create the SQL Adapter
Dim DbAdapter As New SqlDataAdapter("EXEC LookupAllCategories", DbConnection)
' Get Result Set
Dim CategoryInfo As New DataSet
DbAdapter.Fill(CategoryInfo, "CategoryInfo")
' Return Result Set
Return CategoryInfo
End Function
End Class