This example executes a Stored Procedure when you load a form. This example uses a Data Grid to store the results.
- 'Create a SqlCommand to represent the query
Dim cmd As SqlCommand = SqlConnection1.CreateCommand
SqlConnection1.CreateCommand()
cmd.CommandType = CommandType.StoredProcedure
cmd.CommandText = txtQuery.Text - 'Create a SqlDataAdapter to talk to the database
Dim da As SqlDataAdapter = New SqlDataAdapter
da.SelectCommand = cmd - 'Create a DataSet to hold the results
Dim ds As DataSet = New DataSet
'Fill the Dataset
da.Fill(ds, "Results") - 'And bind it to the DataGrid
dgResults.DataSource = ds
dgResults.DataMember = "Results"

Delicious
Digg
Google
Yahoo