Qualcosa del genere?

Private Sub BindGrid(Optional ByVal sortfield As String = "")
'se già hai la connessione ovviamente non serve
Dim cnn As SqlConnection
Dim da As SqlDataAdapter
Dim ds As New DataSet()

'qui serve una connessione attiva(cnn)

If sortfield = "" Then
da = New SqlDataAdapter("select campo1,campo2,campo3 from tabella", cnn)
Else
da = New SqlDataAdapter("select campo1,campo2,campo3 from tabella order by " & sortfield, cnn)
End If

da.Fill(ds, "tabella")

DataGrid1.DataSource = ds
DataGrid1.DataMember = "employees"
DataGrid1.DataBind()

End Sub


Private Sub DataGrid1_SortCommand(ByVal source As Object, ByVal e As System.Web.UI.WebControls.DataGridSortCommandEvent Args) Handles DataGrid1.SortCommand
BindGrid(e.SortExpression)
End Sub