2011-08-24 36 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

偉大的....不客氣... –