Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
Dim ds As DataSet
ds = getData()
Dim dt As DataTable = ds.Tables(0)
Dim gridViewData = From r As DataRow In dt.Rows Select r.Item("foo"), r.Item("bar")
GridView1.DataSource = gridViewData
GridView1.DataBind()
End Sub
I just wrote the preceeding code and I get the following compile-time error: "Range variable name can be inferred only from a simple or qualified name with no arguments". Why do I get this error? How can I fix my code?