Public CategoryID As Integer
Sub Page_Load
Dim conNorthwind As SqlConnection
Dim strSelect As String
Dim cmdSelect As SqlCommand
conNorthwind = New SqlConnection( "Server=Localhost;UID=sa;PWD=secret;Database=Northwind" )
strSelect = "Select * From Products Where CategoryID=@CategoryID"
cmdSelect = New SqlCommand( strSelect, conNorthwind )
cmdSelect.Parameters.Add( "@CategoryID", CategoryID )
conNorthwind.Open()
dgrdProducts.DataSource = cmdSelect.ExecuteReader()
dgrdProducts.DataBind()
conNorthwind.Close()
End Sub
Welcome to Our Web Site!
Here is a list of our current products:
ID="dgrdProducts"
Runat="Server" />
( Control generated: )