|
web
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Datareader binding to datagrid not workingbeen writing all my asp.net work using DW and am just now trying to build a application that will read some of the tables I had written out from my web apps. I can get my DataReader to read my data fine. But I wanted to use a DataGrid, but it is apparently completely different???? I can do: DataGrid1.DataSource = dbReader DataGrid1.DataBind() I get an error saying something about: "Complex DataBinding accepts as a data source either an IList or an IListSource". There also doesn't seem to be a DataBind() method to this DataGrid? Why doesn't it work? Can I not make a standalone program using the same techniques as I do in my Web pages (asp.net)? Thanks, Tom tshad wrote:
Show quoteHide quote > I am using VS 2003 and trying to build a standalone application. I have You can not bind a datareader to a datasource. You will need to either > been writing all my asp.net work using DW and am just now trying to build a > application that will read some of the tables I had written out from my web > apps. > > I can get my DataReader to read my data fine. But I wanted to use a > DataGrid, but it is apparently completely different???? > > I can do: > > DataGrid1.DataSource = dbReader > DataGrid1.DataBind() > > I get an error saying something about: "Complex DataBinding accepts as a > data source either an IList or an IListSource". > > There also doesn't seem to be a DataBind() method to this DataGrid? > > Why doesn't it work? > > Can I not make a standalone program using the same techniques as I do in my > Web pages (asp.net)? > > Thanks, > > Tom > > load it into a datatable by looping through the datareader or use a dataadapter to do what you want. chris
Show quote
Hide quote
"I Don't Like Spam" <no@spam.com> wrote in message Is that something that something that you can only do in a web page? I news:OH0LCLiIGHA.3984@TK2MSFTNGP14.phx.gbl... > tshad wrote: >> I am using VS 2003 and trying to build a standalone application. I have >> been writing all my asp.net work using DW and am just now trying to build >> a application that will read some of the tables I had written out from my >> web apps. >> >> I can get my DataReader to read my data fine. But I wanted to use a >> DataGrid, but it is apparently completely different???? >> >> I can do: >> >> DataGrid1.DataSource = dbReader >> DataGrid1.DataBind() >> >> I get an error saying something about: "Complex DataBinding accepts as a >> data source either an IList or an IListSource". >> >> There also doesn't seem to be a DataBind() method to this DataGrid? >> >> Why doesn't it work? >> >> Can I not make a standalone program using the same techniques as I do in >> my Web pages (asp.net)? >> >> Thanks, >> >> Tom >> >> > > You can not bind a datareader to a datasource. You will need to either > load it into a datatable by looping through the datareader or use a > dataadapter to do what you want. > databind datareaders to a datagrid all the time? Tom Show quoteHide quote > chris Thsad,
Although that the grid have in net 1.x for ASPNET and Windowforms the same name (DataGrid), do they act completely different (in Net 2.0 the new Grids have different names, it is probably not for nothing that this confusing thing is now done well). However there are some things the same. The ASPNET datagrid accepts a DataReader, a Datatable and a DataSet. A windowform DataGrid (in theory more however in fact) only the last two. To see a lot of samples about the datagrid can you look on our (non commercial) website. http://www.vb-tips.com/default.aspx I hope this helps, Cor Show quoteHide quote "tshad" <tscheider***@ftsolutions.com> schreef in bericht news:uZ5LPIiIGHA.2704@TK2MSFTNGP15.phx.gbl... >I am using VS 2003 and trying to build a standalone application. I have >been writing all my asp.net work using DW and am just now trying to build a >application that will read some of the tables I had written out from my web >apps. > > I can get my DataReader to read my data fine. But I wanted to use a > DataGrid, but it is apparently completely different???? > > I can do: > > DataGrid1.DataSource = dbReader > DataGrid1.DataBind() > > I get an error saying something about: "Complex DataBinding accepts as a > data source either an IList or an IListSource". > > There also doesn't seem to be a DataBind() method to this DataGrid? > > Why doesn't it work? > > Can I not make a standalone program using the same techniques as I do in > my Web pages (asp.net)? > > Thanks, > > Tom > > |
|||||||||||||||||||||||