The DataTable.Select method returns an Array of DataRows. Theoretically, you can bind a control to an Array because it implements the IList and ICollection interfaces. But in this case, each item in the Array contains a DataRow, so your control would show multiple entries of "System.Data.DataRow", instead of the column you want. The DataRow class does not have any public property called ColumnName which would allow you to specify the DisplayMember or ValueMember.
Therefore, the solution is to convert the DataTable to a DataView using the RowFilter which works in the same way as the Select method of the DataTable. The DataView can then be easily bound to any control and you can set the DisplayMember and ValueMember properties to the column names you want. On Aug 29, 2:50 pm, velsankar <[EMAIL PROTECTED]> wrote: > Hi, > > I am trying to assign a particular column values to combo box under > certain condition. > We can get datarow[] from dataset by select method (condition as > query). > Is it possible to assign a (single) column of the datarow [] to > combobox datasource. > That means, it need not to be combobox datasource or Items.Add() but > something else... > In simple, want to add the column values of the datarow[] to combobox > The basic idea is to avoid loops & recursive methods. Any idea???? > > Thanks & Regards, > Vels --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "DotNetDevelopment, VB.NET, C# .NET, ADO.NET, ASP.NET, XML, XML Web Services,.NET Remoting" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://cm.megasolutions.net/forums/default.aspx -~----------~----~----~----~------~----~------~--~---
