K
Kathleen Dollard
STom,
Hopefully my earlier response answered this.
Yes, you can bind an array of datarows to a grid.
Kathleen
I am pulling my hair out over this, I know it can't be this difficult. Here
is my code:
Dim lConn As SqlConnection
Dim da As New SqlDataAdapter
Dim ds As New DataSet
Dim dar As DataRow()
lConn = New SqlConnection("Data Source=(local);Initial Catalog=pubs;User
Id=sa;Password=;")
Const strSQL As String = "Select * From Employee"
Dim myCommand As New SqlCommand(strSQL, lConn)
da.SelectCommand = New SqlCommand(strSQL, lConn)
da.Fill(ds)
dar = ds.Tables(0).Select("ORDER BY fname DESC")
DataGrid1.DataSource = dar
DataGrid1.DataBind()
When I run this, on the like where I fill the datarow array I get an error
that says: Missing operand after 'BY' operator.
If I remove the ORDER BY and run it (thinking it might not need to ORDER BY
to understand what it needs to do), I get an error that says: Missing
operand after 'DESC' operator.
What the heck is this thing looking for? Can you even bind a datarow array
to a grid?
Thanks.
STom
Hopefully my earlier response answered this.
Yes, you can bind an array of datarows to a grid.
Kathleen
I am pulling my hair out over this, I know it can't be this difficult. Here
is my code:
Dim lConn As SqlConnection
Dim da As New SqlDataAdapter
Dim ds As New DataSet
Dim dar As DataRow()
lConn = New SqlConnection("Data Source=(local);Initial Catalog=pubs;User
Id=sa;Password=;")
Const strSQL As String = "Select * From Employee"
Dim myCommand As New SqlCommand(strSQL, lConn)
da.SelectCommand = New SqlCommand(strSQL, lConn)
da.Fill(ds)
dar = ds.Tables(0).Select("ORDER BY fname DESC")
DataGrid1.DataSource = dar
DataGrid1.DataBind()
When I run this, on the like where I fill the datarow array I get an error
that says: Missing operand after 'BY' operator.
If I remove the ORDER BY and run it (thinking it might not need to ORDER BY
to understand what it needs to do), I get an error that says: Missing
operand after 'DESC' operator.
What the heck is this thing looking for? Can you even bind a datarow array
to a grid?
Thanks.
STom