sql server 2012 - how to display records to 2 listview in c# from sql database? -


i display record database c# in listview. when display record 2 different listview, record in second listview not appear.

in listview1, display record package = textbox4.text, in listview2, display record package = textbox5.text.

here line of code, records in first listview display.

please me. thank you

//code first listview mysqlconnection.open(); sqlcommand command1 = new sqlcommand("select * reservation_inventory package='"+textbox4.text+"'", mysqlconnection);  p_table.clear(); sqldataadapter m_da = new sqldataadapter("select * reservation_inventory package='" + textbox4.text + "'", mysqlconnection);  m_da.fill(p_table); listview1.items.clear();  (int = 0; < p_table.rows.count; i++) {     datarow drow = p_table.rows[i];      if (drow.rowstate != datarowstate.deleted)     {         listviewitem lvi = new listviewitem(drow["id"].tostring());         lvi.subitems.add(drow["equipment"].tostring());         lvi.subitems.add(drow["status"].tostring());         listview1.items.add(lvi);     } }  // code second listview sqlcommand command2 = new sqlcommand("select * reservation_inventory package='" + textbox5.text + "'", mysqlconnection);  p_table.clear(); sqldataadapter m_da2 = new sqldataadapter("select * reservation_inventory package='" + textbox5.text + "'", mysqlconnection);  m_da.fill(p_table); listview2.items.clear();  (int = 0; < p_table.rows.count; i++) {     datarow drow = p_table.rows[i];      if (drow.rowstate != datarowstate.deleted)     {         listviewitem lvi = new listviewitem(drow["id"].tostring());         lvi.subitems.add(drow["equipment"].tostring());         lvi.subitems.add(drow["status"].tostring());         listview1.items.add(lvi);     } } 

in second loop change

listview1.items.add(lvi); 

to

listview2.items.add(lvi); 

Comments

Popular posts from this blog

Android layout hidden on keyboard show -

google app engine - 403 Forbidden POST - Flask WTForms -

c - Why would PK11_GenerateRandom() return an error -8023? -