我想要使用每個listbox1項目來運行這兩個查詢,如果兩個結果都不同於將該項目移動到另一個名爲listbox2的列表框(如果它們與從listbox1刪除該項目相同)。將列表框項目移動到另一個列表框?
foreach (string Items in listBox1.Items)
{
using (OracleCommand crtCommand = new OracleCommand("select count(*) from((select * from all_ind_columns where index_name= '" + Items + "' and table_owner='" + txtSrcUserID.Text.ToUpper() + "'))", conn1))
using (OracleCommand ctCommand = new OracleCommand("select count(*) from((select * from all_ind_columns where index_name= '" + Items + "' and table_owner='" + txtDesUserID.Text.ToUpper() + "'))", conn1))
{
string result1 = crtCommand.ExecuteScalar().ToString();
string result2 = ctCommand.ExecuteScalar().ToString();
if (result1 != result2)
{
//move that item to listbox2
}
else if(result1 == result2)
{
// remove that item from listbox1
}
}
}
然後,發生了什麼呢? –