Imports System.Data.SqlClient Imports System.Data Partial Public Class WebForm1 Inherits System.Web.UI.Page Protected Sub Button1_Click(ByVal sender As Object, ByVal e As EventArgs) Handles Button1.Click 'Create and open aconnection to Northwind database Dim conn As SqlConnection = New SqlConnection("Data Source=.;Initial Catalog=Northwind;Integrated Security=TRUE") conn.Open() Dim com As SqlCommand = New SqlCommand() com.Connection = conn com.CommandText = "CustOrderHist" com.CommandType = CommandType.StoredProcedure Dim param As SqlParameter = New SqlParameter("@CustomerID", SqlDbType.NVarChar, 5) param.Value = txtCustomerID.Text com.Parameters.Add(param) 'Call the command's ExecuteReader method Dim dr As SqlDataReader = com.ExecuteReader() ListBox1.Items.Clear() 'Loop through the datareader to output the products ordered While (dr.Read()) 'dr.GetString(1) ListBox1.Items.Add(dr("ProductName") + " " + dr("Total").ToString()) End While 'Close the datareader & connection dr.Close() conn.Close() End Sub End Class