Connecting Tech Pros Worldwide Forums | Help | Site Map

Order by Clause....

Smith John
Guest
 
Posts: n/a
#1: Nov 19 '05
I am creating a table object inside a dataset and attaching that to the

datagrid.



DataGrid1.DataSource = myDataset.Tables("myTable")

DataGrid1.DataBind()



Is there anyway before I bind the data to the grid can I sort the data
defining a column.

Like order by criteria in SQL.

Thanks,

Smith



Karl Seguin
Guest
 
Posts: n/a
#2: Nov 19 '05

re: Order by Clause....


dim dv as DataView = myDataSet.Tables("myTable")
dv.Sort = "MyColumn ASC"
DataGrid1.DataSource = dv
DataGrid1.DataBind()

Karl

--
MY ASP.Net tutorials
http://www.openmymind.net/


"Smith John" <JohnSmith56@hotmail.com> wrote in message
news:O5JgrE$2EHA.2112@TK2MSFTNGP15.phx.gbl...[color=blue]
> I am creating a table object inside a dataset and attaching that to the
>
> datagrid.
>
>
>
> DataGrid1.DataSource = myDataset.Tables("myTable")
>
> DataGrid1.DataBind()
>
>
>
> Is there anyway before I bind the data to the grid can I sort the data
> defining a column.
>
> Like order by criteria in SQL.
>
> Thanks,
>
> Smith
>
>[/color]


Smith John
Guest
 
Posts: n/a
#3: Nov 19 '05

re: Order by Clause....


Thank you Karl for the soultion.
This step involves converting the data to dataview which involves few CPU
cycles.
Before implementing this I want to make sure there is no other method which
is build in the dataset or dataset table is available.
Thanks,
Smith





"Karl Seguin" <karl REMOVE @ REMOVE openmymind REMOVEMETOO . ANDME net>
wrote in message news:uuKl2Y$2EHA.2876@TK2MSFTNGP12.phx.gbl...[color=blue]
> dim dv as DataView = myDataSet.Tables("myTable")
> dv.Sort = "MyColumn ASC"
> DataGrid1.DataSource = dv
> DataGrid1.DataBind()
>
> Karl
>
> --
> MY ASP.Net tutorials
> http://www.openmymind.net/
>
>
> "Smith John" <JohnSmith56@hotmail.com> wrote in message
> news:O5JgrE$2EHA.2112@TK2MSFTNGP15.phx.gbl...[color=green]
> > I am creating a table object inside a dataset and attaching that to the
> >
> > datagrid.
> >
> >
> >
> > DataGrid1.DataSource = myDataset.Tables("myTable")
> >
> > DataGrid1.DataBind()
> >
> >
> >
> > Is there anyway before I bind the data to the grid can I sort the data
> > defining a column.
> >
> > Like order by criteria in SQL.
> >
> > Thanks,
> >
> > Smith
> >
> >[/color]
>
>[/color]


Smith John
Guest
 
Posts: n/a
#4: Nov 19 '05

re: Order by Clause....


I have set Option Explicit On
I am getting the error for the below line.
dim dv as DataView = myDataSet.Tables("myTable")

I am using .Net Framework 1.1.
Please advice.
Thanks
Smith


"Karl Seguin" <karl REMOVE @ REMOVE openmymind REMOVEMETOO . ANDME net>
wrote in message news:uuKl2Y$2EHA.2876@TK2MSFTNGP12.phx.gbl...[color=blue]
> dim dv as DataView = myDataSet.Tables("myTable")
> dv.Sort = "MyColumn ASC"
> DataGrid1.DataSource = dv
> DataGrid1.DataBind()
>
> Karl
>
> --
> MY ASP.Net tutorials
> http://www.openmymind.net/
>
>
> "Smith John" <JohnSmith56@hotmail.com> wrote in message
> news:O5JgrE$2EHA.2112@TK2MSFTNGP15.phx.gbl...[color=green]
> > I am creating a table object inside a dataset and attaching that to the
> >
> > datagrid.
> >
> >
> >
> > DataGrid1.DataSource = myDataset.Tables("myTable")
> >
> > DataGrid1.DataBind()
> >
> >
> >
> > Is there anyway before I bind the data to the grid can I sort the data
> > defining a column.
> >
> > Like order by criteria in SQL.
> >
> > Thanks,
> >
> > Smith
> >
> >[/color]
>
>[/color]


Karl Seguin
Guest
 
Posts: n/a
#5: Nov 19 '05

re: Order by Clause....


Oopss...

dim dv as dataview = myDataSet.TAbles("myTable").DefaultView

Karl

--
MY ASP.Net tutorials
http://www.openmymind.net/


"Smith John" <JohnSmith56@hotmail.com> wrote in message
news:OEgej2$2EHA.2804@TK2MSFTNGP15.phx.gbl...[color=blue]
> I have set Option Explicit On
> I am getting the error for the below line.
> dim dv as DataView = myDataSet.Tables("myTable")
>
> I am using .Net Framework 1.1.
> Please advice.
> Thanks
> Smith
>
>
> "Karl Seguin" <karl REMOVE @ REMOVE openmymind REMOVEMETOO . ANDME net>
> wrote in message news:uuKl2Y$2EHA.2876@TK2MSFTNGP12.phx.gbl...[color=green]
> > dim dv as DataView = myDataSet.Tables("myTable")
> > dv.Sort = "MyColumn ASC"
> > DataGrid1.DataSource = dv
> > DataGrid1.DataBind()
> >
> > Karl
> >
> > --
> > MY ASP.Net tutorials
> > http://www.openmymind.net/
> >
> >
> > "Smith John" <JohnSmith56@hotmail.com> wrote in message
> > news:O5JgrE$2EHA.2112@TK2MSFTNGP15.phx.gbl...[color=darkred]
> > > I am creating a table object inside a dataset and attaching that to[/color][/color][/color]
the[color=blue][color=green][color=darkred]
> > >
> > > datagrid.
> > >
> > >
> > >
> > > DataGrid1.DataSource = myDataset.Tables("myTable")
> > >
> > > DataGrid1.DataBind()
> > >
> > >
> > >
> > > Is there anyway before I bind the data to the grid can I sort the data
> > > defining a column.
> > >
> > > Like order by criteria in SQL.
> > >
> > > Thanks,
> > >
> > > Smith
> > >
> > >[/color]
> >
> >[/color]
>
>[/color]


Karl Seguin
Guest
 
Posts: n/a
#6: Nov 19 '05

re: Order by Clause....


heh..cpu cycles....those couple milliseconds will really come back to haunt
you....well, rest assured, when you do XXXXX.DataSource = DataSet/DataTable,
it automatically fetches the DefaultView from those (ie, you are always
binding to a DataView), so there is no performance penalty. Frankly, you
want things to be ordered but don't expect to spend any cpu cycles doing it?

Karl

--
MY ASP.Net tutorials
http://www.openmymind.net/


"Smith John" <JohnSmith56@hotmail.com> wrote in message
news:%23scUn0$2EHA.2196@TK2MSFTNGP14.phx.gbl...[color=blue]
> Thank you Karl for the soultion.
> This step involves converting the data to dataview which involves few CPU
> cycles.
> Before implementing this I want to make sure there is no other method[/color]
which[color=blue]
> is build in the dataset or dataset table is available.
> Thanks,
> Smith
>
>
>
>
>
> "Karl Seguin" <karl REMOVE @ REMOVE openmymind REMOVEMETOO . ANDME net>
> wrote in message news:uuKl2Y$2EHA.2876@TK2MSFTNGP12.phx.gbl...[color=green]
> > dim dv as DataView = myDataSet.Tables("myTable")
> > dv.Sort = "MyColumn ASC"
> > DataGrid1.DataSource = dv
> > DataGrid1.DataBind()
> >
> > Karl
> >
> > --
> > MY ASP.Net tutorials
> > http://www.openmymind.net/
> >
> >
> > "Smith John" <JohnSmith56@hotmail.com> wrote in message
> > news:O5JgrE$2EHA.2112@TK2MSFTNGP15.phx.gbl...[color=darkred]
> > > I am creating a table object inside a dataset and attaching that to[/color][/color][/color]
the[color=blue][color=green][color=darkred]
> > >
> > > datagrid.
> > >
> > >
> > >
> > > DataGrid1.DataSource = myDataset.Tables("myTable")
> > >
> > > DataGrid1.DataBind()
> > >
> > >
> > >
> > > Is there anyway before I bind the data to the grid can I sort the data
> > > defining a column.
> > >
> > > Like order by criteria in SQL.
> > >
> > > Thanks,
> > >
> > > Smith
> > >
> > >[/color]
> >
> >[/color]
>
>[/color]


John Smith
Guest
 
Posts: n/a
#7: Nov 19 '05

re: Order by Clause....


Karl,
Thanks for the answer.
Smith

"Karl Seguin" <karl REMOVE @ REMOVE openmymind REMOVEMETOO . ANDME net>
wrote in message news:#IC8ENA3EHA.1472@TK2MSFTNGP10.phx.gbl...[color=blue]
> heh..cpu cycles....those couple milliseconds will really come back to[/color]
haunt[color=blue]
> you....well, rest assured, when you do XXXXX.DataSource =[/color]
DataSet/DataTable,[color=blue]
> it automatically fetches the DefaultView from those (ie, you are always
> binding to a DataView), so there is no performance penalty. Frankly, you
> want things to be ordered but don't expect to spend any cpu cycles doing[/color]
it?[color=blue]
>
> Karl
>
> --
> MY ASP.Net tutorials
> http://www.openmymind.net/
>
>
> "Smith John" <JohnSmith56@hotmail.com> wrote in message
> news:%23scUn0$2EHA.2196@TK2MSFTNGP14.phx.gbl...[color=green]
> > Thank you Karl for the soultion.
> > This step involves converting the data to dataview which involves few[/color][/color]
CPU[color=blue][color=green]
> > cycles.
> > Before implementing this I want to make sure there is no other method[/color]
> which[color=green]
> > is build in the dataset or dataset table is available.
> > Thanks,
> > Smith
> >
> >
> >
> >
> >
> > "Karl Seguin" <karl REMOVE @ REMOVE openmymind REMOVEMETOO . ANDME net>
> > wrote in message news:uuKl2Y$2EHA.2876@TK2MSFTNGP12.phx.gbl...[color=darkred]
> > > dim dv as DataView = myDataSet.Tables("myTable")
> > > dv.Sort = "MyColumn ASC"
> > > DataGrid1.DataSource = dv
> > > DataGrid1.DataBind()
> > >
> > > Karl
> > >
> > > --
> > > MY ASP.Net tutorials
> > > http://www.openmymind.net/
> > >
> > >
> > > "Smith John" <JohnSmith56@hotmail.com> wrote in message
> > > news:O5JgrE$2EHA.2112@TK2MSFTNGP15.phx.gbl...
> > > > I am creating a table object inside a dataset and attaching that to[/color][/color]
> the[color=green][color=darkred]
> > > >
> > > > datagrid.
> > > >
> > > >
> > > >
> > > > DataGrid1.DataSource = myDataset.Tables("myTable")
> > > >
> > > > DataGrid1.DataBind()
> > > >
> > > >
> > > >
> > > > Is there anyway before I bind the data to the grid can I sort the[/color][/color][/color]
data[color=blue][color=green][color=darkred]
> > > > defining a column.
> > > >
> > > > Like order by criteria in SQL.
> > > >
> > > > Thanks,
> > > >
> > > > Smith
> > > >
> > > >
> > >
> > >[/color]
> >
> >[/color]
>
>[/color]


John Smith
Guest
 
Posts: n/a
#8: Nov 19 '05

re: Order by Clause....


Karl,
This worked well for me.
Thanks.
Smith


"Karl Seguin" <karl REMOVE @ REMOVE openmymind REMOVEMETOO . ANDME net>
wrote in message news:eiHtjLA3EHA.3380@TK2MSFTNGP09.phx.gbl...[color=blue]
> Oopss...
>
> dim dv as dataview = myDataSet.TAbles("myTable").DefaultView
>
> Karl
>
> --
> MY ASP.Net tutorials
> http://www.openmymind.net/
>
>
> "Smith John" <JohnSmith56@hotmail.com> wrote in message
> news:OEgej2$2EHA.2804@TK2MSFTNGP15.phx.gbl...[color=green]
> > I have set Option Explicit On
> > I am getting the error for the below line.
> > dim dv as DataView = myDataSet.Tables("myTable")
> >
> > I am using .Net Framework 1.1.
> > Please advice.
> > Thanks
> > Smith
> >
> >
> > "Karl Seguin" <karl REMOVE @ REMOVE openmymind REMOVEMETOO . ANDME net>
> > wrote in message news:uuKl2Y$2EHA.2876@TK2MSFTNGP12.phx.gbl...[color=darkred]
> > > dim dv as DataView = myDataSet.Tables("myTable")
> > > dv.Sort = "MyColumn ASC"
> > > DataGrid1.DataSource = dv
> > > DataGrid1.DataBind()
> > >
> > > Karl
> > >
> > > --
> > > MY ASP.Net tutorials
> > > http://www.openmymind.net/
> > >
> > >
> > > "Smith John" <JohnSmith56@hotmail.com> wrote in message
> > > news:O5JgrE$2EHA.2112@TK2MSFTNGP15.phx.gbl...
> > > > I am creating a table object inside a dataset and attaching that to[/color][/color]
> the[color=green][color=darkred]
> > > >
> > > > datagrid.
> > > >
> > > >
> > > >
> > > > DataGrid1.DataSource = myDataset.Tables("myTable")
> > > >
> > > > DataGrid1.DataBind()
> > > >
> > > >
> > > >
> > > > Is there anyway before I bind the data to the grid can I sort the[/color][/color][/color]
data[color=blue][color=green][color=darkred]
> > > > defining a column.
> > > >
> > > > Like order by criteria in SQL.
> > > >
> > > > Thanks,
> > > >
> > > > Smith
> > > >
> > > >
> > >
> > >[/color]
> >
> >[/color]
>
>[/color]


Closed Thread