[COLOR="Blue"]Dim [/COLOR]dsMyDataSet [COLOR="blue"]As New [/COLOR]DataSet
[COLOR="blue"]Using [/COLOR]con [COLOR="blue"]As New [/COLOR]SqlConnection(g_strDatabaseConnection)
[COLOR="blue"]Dim [/COLOR]cmdSelect [COLOR="blue"]As New [/COLOR]SqlCommand
[COLOR="blue"]Dim [/COLOR]da [COLOR="blue"]As New [/COLOR]SqlDataAdapter
cmdSelect.Connection = con
cmdSelect.CommandType = CommandType.StoredProcedure
cmdSelect.CommandText = [COLOR="DarkRed"]"spMyStoredProcedureName"[/COLOR]
[COLOR="SeaGreen"]'Two parameters for the stored procedure[/COLOR]
[COLOR="seagreen"]'First is @PckId and Second is @CustKey[/COLOR]
cmdSelect.Parameters.AddWithValue([COLOR="darkred"]"@PckId"[/COLOR], strPck)
cmdSelect.Parameters.AddWithValue([COLOR="darkred"]"@CustKey"[/COLOR], intCustKey)
da.Fill(dsMyDataSet, [COLOR="DarkRed"]"MyTableName"[/COLOR])
da.Dispose()
cmdSelect.Dispose()
[COLOR="blue"]End Using[/COLOR] [COLOR="seagreen"]'con[/COLOR]
dgvDataViewer.DataSource = dsMyDataSet.Tables([COLOR="DarkRed"]"MyTableName"[/COLOR]) [COLOR="seagreen"]'or table index[/COLOR]