5

i have customer table have columns with

                                      customer id
                                     customer name 

I have another table called address addressid addresstext

now i want to display the customer name and addresstext like this

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

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

like this in list view only single column above figureenter image description here

would any one pls help on this..

I am using c# in winforms applications

1
  • would any one pls helop on this... Commented Aug 24, 2011 at 10:29

3 Answers 3

5

Many Thanks For all your support and i have solved my problem ........like this

    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 });
Sign up to request clarification or add additional context in comments.

Comments

0

If you are asking about how to populate the list view with the data from the sql table then have a look at

http://social.msdn.microsoft.com/Forums/en-US/csharpgeneral/thread/2725cfac-76a0-42f3-90b2-93c6ab96d901/

Comments

0

You need to to create a foreign key on your address table that pointed to the customer id.

1 Comment

is it possible just display the address names and customer name from two different tables.... just display the items in list view with two groups...

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.