imade this query and named it as vwOwnerAnimal. my problem is that i don't know how to display it using listview. can anyone pls help me.

SELECT tbowner.owner_code, tbowner.owner_name, tbowner.owner_add, tbowner.owner_cn, tbowneranimal.a_name, tbowneranimal.a_breed, tbowneranimal.a_age, tbowneranimal.a_sex
FROM tbowner INNER JOIN tbowneranimal ON tbowner.owner_code = tbowneranimal.owner_code;

Your first problem is using a ListView. It is not designed to be used with databases. However, a DataGridView will take a DataTable as a DataSource and will display whatever data you put in the datatable.

If you must use a ListView you'll have to do it the naive way. Return your query to a DataTable. Loop through the columns to replicate them in the Listview. Loop through the rows and build new ListViewItems based on the data in each row.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.