Click here to Skip to main content
16,019,018 members
Please Sign up or sign in to vote.
2.00/5 (1 vote)
See more:
Hello,

How to pass select query for xml database?

I have to create application like in that have total 4 listbox.Every listbox have information which i have sorted by using xml file.Now i want to fetch all data which is selected by listbox to listview.I also fetch it.but not all data.

Example: Listbox1 have all names ,Listbox2 have division,Listbox3 have address,Listbox4 have marks.

when i select name suppose "A",the select division like "B" ,select address like "C",now in listbox 4 have marks of those name which i select.more than one name can have same marks like "80.00%".initailly i don't want to show anything in listbox4.
after selecting Listbox1 and Listbox2 ,Listbox3 want to directly show in listview d all 4 entries i.e.

name division Address marks

how to fire select query for it? in xml file i have all data and read it using DataRow.

Expected output in listview as:


name Division Address Marks

A B C 80.00%

A B C 81.00%

A B C 82.00%

how to do it?I jcan just fetch first row not all.
Posted
Comments
Maciej Los 17-May-12 16:32pm    
I think, no one can understand you. Why 4 xml files for each listbox?
Member 8131879[Sneha K] 18-May-12 0:30am    
Hello,
I have to fetch all data from xml file.In xml file have columns like above and with respect to column names i have to fetch data to listbox.
Member 8131879[Sneha K] 18-May-12 3:33am    
I am not using 4 xml files here.Used only one xml file but,fetch columnwise data in seperate listbox.

1 solution

Hello,

I got the solution for how to pass query.


C#
DataRow[] resdtrow;

ds.ReadXml("abc.xml");

resdtrow = ds.Tables["TagData"].Select("Node='" + pstrNode + "' and TagType='" + pstrTagType + "' and Port='" + pstrComPort + "' and NoOfBytes='" + pstrTagSize + "'");

foreach (DataRow dr in resdtrow)
 {
       view = new ListViewItem(dr[4].ToString());
       view.SubItems.Add(dr[5].ToString());
}
 
Share this answer
 
v3
Comments
Mohamed Mitwalli 18-May-12 9:40am    
Well Mark your solutions as answer .

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900