Web

Creare Data Adapter che riempe DataSet

Dim comando As SqlCommand
Dim query As String
Dim da As New SqlDataAdapter
Dim ds As DataSet
Dim tabella As DataTable

query = "SELECT * FROM TABELLA WHERE ID=@ID"
comando = New SqlCommand(query, Connessione)
comando.Parameters.AddWithValue("@ID", ID)
da.SelectCommand = comando
ds = New DataSet
da.Fill(ds)
tabella = ds.Tables(0)
If tabella.Rows.Count > 0 Then
    Me.grid_view.DataSource = tabella
    Me.grid_view.DataBind()
Else
    Me.grid_view.DataSource = Nothing
    Me.grid_view.DataBind()
End If