Imports System Imports System.Data.SqlClient Public Class StoredProcedureDemo2 Inherits System.Web.UI.Page Protected WithEvents DataGrid1 As System.Web.UI.WebControls.DataGrid #Region " Web Form Designer Generated Code " 'This call is required by the Web Form Designer. Private Sub InitializeComponent() End Sub Private Sub Page_Init(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Init 'CODEGEN: This method call is required by the Web Form Designer 'Do not modify it using the code editor. InitializeComponent() End Sub #End Region Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load Dim MyDataAdapter As SqlDataAdapter Dim MyConn As SqlConnection Dim MySQLCommand As SqlCommand Dim sDSN As String sDSN = "server=student.bus.olemiss.edu;uid=dbdemo;pwd=dbpass;database=EmailDemo" MyConn = New SqlConnection(sDSN) MyDataAdapter = New SqlDataAdapter() MySQLCommand = New SqlCommand("GetMatchingEmailEntries", MyConn) MySQLCommand.CommandType = CommandType.StoredProcedure MySQLCommand.Parameters.Add("@StuName", SqlDbType.NChar, 50, "StudentName") MySQLCommand.Parameters("@StuName").Value = "Jane Doe" MySQLCommand.Parameters("@StuName").Direction = ParameterDirection.Input MyDataAdapter.SelectCommand = MySQLCommand Dim DS As DataSet DS = New DataSet() MyDataAdapter.Fill(DS, "StudentData") DataGrid1.DataSource = DS.Tables("StudentData").DefaultView DataGrid1.DataBind() End Sub End Class