Re: Please help with dataset Select syntax

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top