|
dev
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
GridView and reader sourceHi, I can give a DataTable to gridview and in one line data are displayed
int the gridview using : dgvEmployee.DataSource = myDataTable.; When I use a dataReader instead, do "dgvEmployee.DataSource = myReader;", nothing is displayed in the gridview. Does that mean that GridView dosnt or can not bind to a data reader Thanks for your help Hi,
"SalamElias" <eliassal@online.nospam> wrote in message I am not sure. Why don't you use SqlDataSource instead?news:C3D9D826-29C3-488F-86F3-48C395E0F221@microsoft.com... > Hi, I can give a DataTable to gridview and in one line data are displayed > int the gridview using : > dgvEmployee.DataSource = myDataTable.; > > When I use a dataReader instead, do "dgvEmployee.DataSource = myReader;", > nothing is displayed in the gridview. > Does that mean that GridView dosnt or can not bind to a data reader > Thanks for your help > -- Miha Markic [MVP C#] RightHand .NET consulting & development www.rthand.com Blog: http://cs.rthand.com/blogs/blog_with_righthand/ Thanks. I havn't used this object(sqldatasource). I need to work with
datareader because I have written a dataAccessLayer that sometimes returns a DataReader and want to know how to bound it to Gridview. Salam Show quote "Miha Markic [MVP C#]" wrote: > Hi, > > "SalamElias" <eliassal@online.nospam> wrote in message > news:C3D9D826-29C3-488F-86F3-48C395E0F221@microsoft.com... > > Hi, I can give a DataTable to gridview and in one line data are displayed > > int the gridview using : > > dgvEmployee.DataSource = myDataTable.; > > > > When I use a dataReader instead, do "dgvEmployee.DataSource = myReader;", > > nothing is displayed in the gridview. > > Does that mean that GridView dosnt or can not bind to a data reader > > Thanks for your help > > > I am not sure. Why don't you use SqlDataSource instead? > > -- > Miha Markic [MVP C#] > RightHand .NET consulting & development www.rthand.com > Blog: http://cs.rthand.com/blogs/blog_with_righthand/ > > > Hi Salam
The DataGrid in an ASP.NET app can be bound to a DataReader to retrieve data. However, the DataGrid in windows form does not accept a DataReader as the data source. So what kind of project are you working on? If winform, I think you have to make the dataAccessLayer return a DataTable or DataSet. Kevin Yu ======= "This posting is provided "AS IS" with no warranties, and confers no rights." SalamElias,
Are you using the DataBind after adding the datasource? http://msdn2.microsoft.com/en-us/library/fkx0cy6d.aspx I hope this helps, Cor So many thanks for all of you. I use heavily DS with DataGrid and wanted to
see if I can use the DataReader as a source for the GridView. Kevin was very clear : Not Possible Thanks again Show quote "Cor Ligthert [MVP]" wrote: > SalamElias, > > Are you using the DataBind after adding the datasource? > > http://msdn2.microsoft.com/en-us/library/fkx0cy6d.aspx > > I hope this helps, > > Cor > > > |
|||||||||||||||||||||||