PC Review Forums Newsgroups Microsoft DotNet Microsoft ADO .NET Re: Please help with dataset Select syntax

Reply

Re: Please help with dataset Select syntax

 
Thread Tools Rate Thread
Old 29-06-2003, 04:54 AM   #1
Kathleen Dollard
Guest
 
Posts: n/a
Default Re: Please help with dataset Select syntax


STom,

Hopefully my earlier response answered this.

Yes, you can bind an array of datarows to a grid.

Kathleen

"STom" <stombiztalker@hotmail.com> wrote in message
news:eEoTMbLPDHA.704@tk2msftngp13.phx.gbl...
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




  Reply With Quote
Reply



Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off