Datareader and grid

G

Graham Lambert

I see you can bind a data reader to a grid in asp.net but not vb.net - Is
there a way to do this?
 
W

William Ryan

Yep, the complex binding need IList or IListSource and the DataReader
doesn't have it.

You could make a DataTable out of your Reader and Bind to that, but
otherwise I don't think you can do it.

Cheers,

bill
 
C

Carl Prothman [MVP]

Graham Lambert said:
I see you can bind a data reader to a grid in asp.net but not vb.net - Is
there a way to do this?

Grapham,
Using a WebForm's DataGrid control, you can bind to a SqlDataReader
using VB.NET or C#.

However, if you are using a WinForm's DataGrid (Windows), then you cannot
use a SqlDataReader to bind to no matter what .NET language you are using.
In this case, you must use a DataSet.

--

Thanks,
Carl Prothman
Microsoft ASP.NET MVP

Hire top-notch developers at http://www.able-consulting.com
 
W

William \(Bill\) Vaughn

I've always thought this was an oversight, but creating a DataTable and
binding to it is expensive. It's far faster to use a DataAdapter Fill to
construct a DataSet/DataTable. Another approach would be to create an
ArrayList and populate it with the data from the DataReader and bind to
that--but I expect the additional code and overhead would be almost equally
expensive.

hth

--
____________________________________
Bill Vaughn
MVP, hRD
www.betav.com
Please reply only to the newsgroup so that others can benefit.
This posting is provided "AS IS" with no warranties, and confers no rights.
__________________________________
 
O

One Handed Man [ OHM ]

Whats an hRD ?


William (Bill) Vaughn said:
I've always thought this was an oversight, but creating a DataTable and
binding to it is expensive. It's far faster to use a DataAdapter Fill to
construct a DataSet/DataTable. Another approach would be to create an
ArrayList and populate it with the data from the DataReader and bind to
that--but I expect the additional code and overhead would be almost equally
expensive.

hth

--
____________________________________
Bill Vaughn
MVP, hRD
www.betav.com
Please reply only to the newsgroup so that others can benefit.
This posting is provided "AS IS" with no warranties, and confers no rights.
__________________________________
 
W

William Ryan

Bill, in the past, I had a bunch of code which used a reader and then I
needed to add a DataGrid and I wanted to bind it. DataReader is sealed so
you can't subclass it an implement IList. The costlyness of trying to get a
dr to bind to a control, in my experience, isn't worth it. It's doable, but
it's a lot of effort for no real discernable functionality.

Anyway, along the way I decided to make BillsDataReader which implemented
IDataReader and IList. My thinking at the time was that I could create a
method called CreateTableToo(TableName) and while Iterating through the
DataReader I could create a table as well. After all, the DataAdapter uses
a Reader to fill DataTables so performance should be similar.

Well, it wasn't, it was much slower unless I was binding to really small
sets. For smaller items (in terms of columns) the Arraylist has worked
pretty well for me but when it's all said and done....If I'm on the desktop,
I'll use da.Fill for sure (It beats writing my 300 line class for sure).

Cheers,

Bill
 
O

One Handed Man [ OHM ]

First time I've heard of this. I suppose this must be the holly grail for
MVP's.
BTW, there seems to be a whole load of MVP's, do they get this status just
by helping out folk on the newsgroups , or is it more invloved than that ?

Regards - OHM
 
W

William \(Bill\) Vaughn

MVPs are nominated by the MVPs and Microsoft industry watchers. Yes,
newsgroup participation helps, but those who provide consistent support to
the developer communities (and there are many) are nominated. User Group
leaders and authors are often nominated as well.

Regional Directors are far fewer in number and are appointed by Microsoft
based on many of the same criteria. In contrast, the RDs generally have more
of an enterprise orientation as they are typically consultants or pundits
that work with larger corporations or have other national exposure.

--
____________________________________
Bill Vaughn
MVP, hRD
www.betav.com
Please reply only to the newsgroup so that others can benefit.
This posting is provided "AS IS" with no warranties, and confers no rights.
__________________________________
 
O

One Handed Man [ OHM ]

Thank you for the insight. I do contribute ona daily basis to the newsgroups
mainly VB.NET. What would you suggest I do ( not authoring ) in order to
increase my chances of nomination ?

Best Regards



William (Bill) Vaughn said:
MVPs are nominated by the MVPs and Microsoft industry watchers. Yes,
newsgroup participation helps, but those who provide consistent support to
the developer communities (and there are many) are nominated. User Group
leaders and authors are often nominated as well.

Regional Directors are far fewer in number and are appointed by Microsoft
based on many of the same criteria. In contrast, the RDs generally have more
of an enterprise orientation as they are typically consultants or pundits
that work with larger corporations or have other national exposure.

--
____________________________________
Bill Vaughn
MVP, hRD
www.betav.com
Please reply only to the newsgroup so that others can benefit.
This posting is provided "AS IS" with no warranties, and confers no rights.
__________________________________

One Handed Man said:
First time I've heard of this. I suppose this must be the holly grail for
MVP's.
BTW, there seems to be a whole load of MVP's, do they get this status just
by helping out folk on the newsgroups , or is it more invloved than that ?

Regards - OHM




William (Bill) Vaughn said:
Honorary (Microsoft) Regional Director.
http://www.microsoftregionaldirectors.com/Public/

--
____________________________________
Bill Vaughn
MVP, hRD
www.betav.com
Please reply only to the newsgroup so that others can benefit.
This posting is provided "AS IS" with no warranties, and confers no rights.
__________________________________

"One Handed Man [ OHM ]"
wrote in message Whats an hRD ?


I've always thought this was an oversight, but creating a
DataTable
and
binding to it is expensive. It's far faster to use a DataAdapter
Fill
to
construct a DataSet/DataTable. Another approach would be to create an
ArrayList and populate it with the data from the DataReader and
bind
to
that--but I expect the additional code and overhead would be almost
equally
expensive.

hth

--
____________________________________
Bill Vaughn
MVP, hRD
www.betav.com
Please reply only to the newsgroup so that others can benefit.
This posting is provided "AS IS" with no warranties, and confers no
rights.
__________________________________

I see you can bind a data reader to a grid in asp.net but not vb.net -
Is
there a way to do this?
 
W

William \(Bill\) Vaughn

Be active in the developer community. Attend user group meetings and help
answer questions. Participate in the technical chats and offer suggestions
to those attending that need help. Writing always helps (at least I think it
helps). There are lots of newsletters, magazines and the like looking for
new content. Helping out here helps too.
Good luck.

--
____________________________________
Bill Vaughn
MVP, hRD
www.betav.com
Please reply only to the newsgroup so that others can benefit.
This posting is provided "AS IS" with no warranties, and confers no rights.
__________________________________

One Handed Man said:
Thank you for the insight. I do contribute ona daily basis to the newsgroups
mainly VB.NET. What would you suggest I do ( not authoring ) in order to
increase my chances of nomination ?

Best Regards



William (Bill) Vaughn said:
MVPs are nominated by the MVPs and Microsoft industry watchers. Yes,
newsgroup participation helps, but those who provide consistent support to
the developer communities (and there are many) are nominated. User Group
leaders and authors are often nominated as well.

Regional Directors are far fewer in number and are appointed by Microsoft
based on many of the same criteria. In contrast, the RDs generally have more
of an enterprise orientation as they are typically consultants or pundits
that work with larger corporations or have other national exposure.

--
____________________________________
Bill Vaughn
MVP, hRD
www.betav.com
Please reply only to the newsgroup so that others can benefit.
This posting is provided "AS IS" with no warranties, and confers no rights.
__________________________________
that
?
Regards - OHM




Honorary (Microsoft) Regional Director.
http://www.microsoftregionaldirectors.com/Public/

--
____________________________________
Bill Vaughn
MVP, hRD
www.betav.com
Please reply only to the newsgroup so that others can benefit.
This posting is provided "AS IS" with no warranties, and confers no
rights.
__________________________________

"One Handed Man [ OHM ]"
wrote in message Whats an hRD ?


I've always thought this was an oversight, but creating a DataTable
and
binding to it is expensive. It's far faster to use a DataAdapter Fill
to
construct a DataSet/DataTable. Another approach would be to
create
an
ArrayList and populate it with the data from the DataReader and bind
to
that--but I expect the additional code and overhead would be almost
equally
expensive.

hth

--
____________________________________
Bill Vaughn
MVP, hRD
www.betav.com
Please reply only to the newsgroup so that others can benefit.
This posting is provided "AS IS" with no warranties, and confers no
rights.
__________________________________

I see you can bind a data reader to a grid in asp.net but not
vb.net -
Is
there a way to do this?
 
O

One Handed Man [ OHM ]

Ok Bill,

Thanks for taking the time to write back to my posts. I'll end my
contrinution to this thread now. But you will be seeing and reading stuff
from me now and in the future.

Maybe I'll make it, lets hope so

Best Regards



William (Bill) Vaughn said:
Be active in the developer community. Attend user group meetings and help
answer questions. Participate in the technical chats and offer suggestions
to those attending that need help. Writing always helps (at least I think it
helps). There are lots of newsletters, magazines and the like looking for
new content. Helping out here helps too.
Good luck.

--
____________________________________
Bill Vaughn
MVP, hRD
www.betav.com
Please reply only to the newsgroup so that others can benefit.
This posting is provided "AS IS" with no warranties, and confers no rights.
__________________________________

One Handed Man said:
Thank you for the insight. I do contribute ona daily basis to the newsgroups
mainly VB.NET. What would you suggest I do ( not authoring ) in order to
increase my chances of nomination ?

Best Regards
support
to
the developer communities (and there are many) are nominated. User Group
leaders and authors are often nominated as well.

Regional Directors are far fewer in number and are appointed by Microsoft
based on many of the same criteria. In contrast, the RDs generally
have
more
of an enterprise orientation as they are typically consultants or pundits
that work with larger corporations or have other national exposure.

--
____________________________________
Bill Vaughn
MVP, hRD
www.betav.com
Please reply only to the newsgroup so that others can benefit.
This posting is provided "AS IS" with no warranties, and confers no rights.
__________________________________

"One Handed Man [ OHM ]"
wrote in message First time I've heard of this. I suppose this must be the holly
grail
for
MVP's.
BTW, there seems to be a whole load of MVP's, do they get this
status
just
by helping out folk on the newsgroups , or is it more invloved than
that
?

Regards - OHM




Honorary (Microsoft) Regional Director.
http://www.microsoftregionaldirectors.com/Public/

--
____________________________________
Bill Vaughn
MVP, hRD
www.betav.com
Please reply only to the newsgroup so that others can benefit.
This posting is provided "AS IS" with no warranties, and confers no
rights.
__________________________________

"One Handed Man [ OHM ]"
wrote in message Whats an hRD ?


I've always thought this was an oversight, but creating a DataTable
and
binding to it is expensive. It's far faster to use a DataAdapter
Fill
to
construct a DataSet/DataTable. Another approach would be to create
an
ArrayList and populate it with the data from the DataReader
and
bind
to
that--but I expect the additional code and overhead would be almost
equally
expensive.

hth

--
____________________________________
Bill Vaughn
MVP, hRD
www.betav.com
Please reply only to the newsgroup so that others can benefit.
This posting is provided "AS IS" with no warranties, and
confers
no
rights.
__________________________________

I see you can bind a data reader to a grid in asp.net but not
vb.net -
Is
there a way to do this?
 
W

William \(Bill\) Vaughn

One other thing. It's tough to know who to nominate if you don't have a
signature.

--
____________________________________
Bill Vaughn
MVP, hRD
www.betav.com
Please reply only to the newsgroup so that others can benefit.
This posting is provided "AS IS" with no warranties, and confers no rights.
__________________________________

One Handed Man said:
Ok Bill,

Thanks for taking the time to write back to my posts. I'll end my
contrinution to this thread now. But you will be seeing and reading stuff
from me now and in the future.

Maybe I'll make it, lets hope so

Best Regards



William (Bill) Vaughn said:
Be active in the developer community. Attend user group meetings and help
answer questions. Participate in the technical chats and offer suggestions
to those attending that need help. Writing always helps (at least I
think
it
helps). There are lots of newsletters, magazines and the like looking for
new content. Helping out here helps too.
Good luck.

--
____________________________________
Bill Vaughn
MVP, hRD
www.betav.com
Please reply only to the newsgroup so that others can benefit.
This posting is provided "AS IS" with no warranties, and confers no rights.
__________________________________

One Handed Man said:
Thank you for the insight. I do contribute ona daily basis to the newsgroups
mainly VB.NET. What would you suggest I do ( not authoring ) in order to
increase my chances of nomination ?

Best Regards



MVPs are nominated by the MVPs and Microsoft industry watchers. Yes,
newsgroup participation helps, but those who provide consistent
support
to
the developer communities (and there are many) are nominated. User Group
leaders and authors are often nominated as well.

Regional Directors are far fewer in number and are appointed by Microsoft
based on many of the same criteria. In contrast, the RDs generally have
more
of an enterprise orientation as they are typically consultants or pundits
that work with larger corporations or have other national exposure.

--
____________________________________
Bill Vaughn
MVP, hRD
www.betav.com
Please reply only to the newsgroup so that others can benefit.
This posting is provided "AS IS" with no warranties, and confers no
rights.
__________________________________

"One Handed Man [ OHM ]"
wrote in message First time I've heard of this. I suppose this must be the holly grail
for
MVP's.
BTW, there seems to be a whole load of MVP's, do they get this status
just
by helping out folk on the newsgroups , or is it more invloved
than
that
?

Regards - OHM




Honorary (Microsoft) Regional Director.
http://www.microsoftregionaldirectors.com/Public/

--
____________________________________
Bill Vaughn
MVP, hRD
www.betav.com
Please reply only to the newsgroup so that others can benefit.
This posting is provided "AS IS" with no warranties, and confers no
rights.
__________________________________

"One Handed Man [ OHM ]"
<terry_burnsREMOVE%FOR%NO%[email protected]>
wrote in message Whats an hRD ?


message
I've always thought this was an oversight, but creating a
DataTable
and
binding to it is expensive. It's far faster to use a DataAdapter
Fill
to
construct a DataSet/DataTable. Another approach would be to create
an
ArrayList and populate it with the data from the DataReader and
bind
to
that--but I expect the additional code and overhead would be
almost
equally
expensive.

hth

--
____________________________________
Bill Vaughn
MVP, hRD
www.betav.com
Please reply only to the newsgroup so that others can benefit.
This posting is provided "AS IS" with no warranties, and confers
no
rights.
__________________________________

I see you can bind a data reader to a grid in asp.net but not
vb.net -
Is
there a way to do this?
 

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

Similar Threads


Top