================================================================= Here is the Visual Basic Code that runs the DB Example. The complete code is below. Note the use of the stored procedures . All can be done using SQL dataconnection sources (drag and drop) but I chose to show the full hard coding. ================================================================= '*Enables the use of SQL connection Imports System.Data Imports System.Data.SqlClient Partial Class DBExample_DBExample Inherits System.Web.UI.Page '*SQLConnection will be used for loading the connection string. Dim sqlCon As New SqlConnection Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load '******************************************************************** '*On page load the connection string will be called in order '*to be used throughout the page code. '******************************************************************** '* Configure the database connection to be usable throughout the page code. sqlCon.ConnectionString = _ System.Configuration.ConfigurationManager.ConnectionStrings("BakeryConnectionString1").ToString() End Sub Protected Sub btnLoad_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnLoad.Click '******************************************************************** '*On click the code below will call the stored procedure '*and load the products table into the gridview for the user to see. '******************************************************************** '* Declare local database objects Dim sqlCom As New SqlCommand Dim sqlDA As New SqlDataAdapter Dim sqlDS As New DataSet '* Set up the command object using a stored procedure. sqlCom.CommandType = CommandType.StoredProcedure sqlCom.CommandText = "up_Product_Retails_Catalog_Get" sqlCom.Connection = sqlCon '*Fills the command object sqlDA.SelectCommand = sqlCom sqlDA.Fill(sqlDS, "Products") '*Binds to the products datagrid. gvwProducts.DataSource = sqlDS gvwProducts.DataBind() '*Closes the data reader and sql connections. sqlCon.Close() End Sub Protected Sub btnSearch_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnSearch.Click '******************************************************************** '*On click the code below will search for a product name by using '*the users input. '*The gridview will load the products' details after a correct '*search. '******************************************************************** '* Declare local database objects. Dim sqlCom As New SqlCommand Dim sqlDA As New SqlDataAdapter Dim sqlDS As New DataSet '* Set up the command object using a stored procedure. sqlCom.CommandType = CommandType.StoredProcedure sqlCom.CommandText = "up_DBexample_Search" sqlCom.Connection = sqlCon '*Parameter used to search the database table. User's input. sqlCom.Parameters.Add("@Product", SqlDbType.VarChar, 30).Value = _ txtSearch.Text '*Fills the command. sqlDA.SelectCommand = sqlCom sqlDA.Fill(sqlDS, "Products") '*Binds to grid. gvwSearch.DataSource = sqlDS gvwSearch.DataBind() '*Closes the data reader and sql connections. sqlCon.Close() End Sub End Class