用DataGridView过滤器实现对应表在标准表上的对应上限和下限

 

 

    我这边是客户端查找对应标准表中的上限和下限,用两个Query找到查找内容和标准表。。。

  代码如下:以做备份

 

 CurrencyManager cm  =  (CurrencyManager)BindingContext[ConditionGridView.DataSource];
                
int  rowCount  =  cm.Count;

                
for  ( int  row  =   0 ; row  <  rowCount;  ++ row)
                
{
                    DataGridViewRow dgvr 
= ConditionGridView.Rows[row];
                    
int tempi = int.Parse(dgvr.Cells[1].Value.ToString());
                    DataGridViewRow dgvr2 
= ConditionGridView.Rows[row + 1];
                    
int tempi2 = int.Parse(dgvr2.Cells[1].Value.ToString());
                    
                    
if (currentExp > tempi && currentExp < tempi2)
                    
{
                        cm.SuspendBinding();
//这是挂起数据的绑定,是必要有的,
                        dgvr.Visible = true;
                        dgvr2.Visible 
= true;
                        num 
= 1;
                     
                         tempi3 
= int.Parse(dgvr.Cells[0].Value.ToString());
                    }

                    
else
                    
{
                        cm.SuspendBinding();
                        
if (num == 1)
                        
{
                            
                            dgvr2.Visible 
= false;
                            num 
= 0;
                        }

                        
else if (num == 0)
                        
{
                            dgvr.Visible 
= false;
                            dgvr2.Visible 
= false;
                        
                        }

                       
    现在手头正好碰到这个问题,知道应该使用数据结构的一个B+和B-算法比较标准,暂时先胡乱写个代码交货。。。

你可能感兴趣的:(用DataGridView过滤器实现对应表在标准表上的对应上限和下限)