2011-08-24 55 views
5

我有客户表有列与显示单列两组

         customer id 
            customer name 

我已经叫地址 另一个表addressid addresstext

现在我要显示的客户名称和addresstext像这样

    customers 
        ----------- 
        customer name 1 
        customer name 2 
        customer name 3 

        addresses 
        ----------- 
        addresstext 1 
        addresstext 2 
        addresstext 3 

像这样在列表视图中只有上图中的单列enter image description here

会不会有人请在此帮助..

我使用C#中的WinForms应用

+0

会不会有人请helop ... –

回答

5

非常感谢您的支持,我已经解决了我的问题.. ......喜欢上了这本

lstviewcategories.View = View.Details; 
    lstviewcategories.Columns.Add(new ColumnHeader() { Width = lstviewcategories.Width - 20 }); 
    lstviewcategories.HeaderStyle = ColumnHeaderStyle.None; 
    lstviewcategories.Sorting = SortOrder.Ascending; 
    lstviewcategories.Dock = DockStyle.None; 

    ListViewGroup categorygroup = new ListViewGroup("Category Types",HorizontalAlignment.Center); 
    lstviewcategories.Groups.Add(categorygroup); 


    var categorytypes = (from categories in abc.categories 
         select categories.category_Name).ToList(); 

    lstviewcategories.Items.Add(new ListViewItem() { Text = "ALL", Group = categorygroup }); 
    foreach (string item in categorytypes) 
    { 

     lstviewcategories.Items.Add(new ListViewItem() { Text = item.ToString(), Group = categorygroup }); 

    } 

    ListViewGroup pricerangegroup = new ListViewGroup("Price Ranges", HorizontalAlignment.Center); 
    lstviewcategories.Groups.Add(pricerangegroup); 

    lstviewcategories.Items.Add(new ListViewItem() { Text = "ALL", Group = pricerangegroup }); 
    lstviewcategories.Items.Add(new ListViewItem() { Text = "0-500", Group = pricerangegroup }); 
    lstviewcategories.Items.Add(new ListViewItem() { Text = "500-1000", Group = pricerangegroup }); 
    lstviewcategories.Items.Add(new ListViewItem() { Text = "1000+", Group = pricerangegroup }); 
0

您需要创建上指出,客户ID地址表的外键。

+0

是否有可能只是显示两个不同表中的地址名称和客户名称....只是显示列表中的项目查看两组...... –

+0

谢谢..我已经解决了我的问题.... –

+0

伟大的....不客气... –