private void FillComboBox0()
{
string line;
int ni; ni = fields.Length/3; this.comboBox0.Items.Clear();  
for(int i = 0; i< ni; i++ ) { line = fields[i,0];  this.comboBox0.Items.Add(line); }
this.comboBox0.SelectedIndex = 0;
} private void FillComboBox(int k)
{
string line;
DataTable dt;
int ni; if (k==2) dds = initSys.ws.GetMaterielPDMList(tj1);
// if (k==3) dds = initSys.ws.GetMaterielPZVList(tj2);
if (k==4) dds = initSys.ws.GetMaterielPDMList("type <> '1'");
// if (k==5) dds = initSys.ws.GetMaterielPZVList(tj3); if (dds != null)
{
dt = dds.Tables[0];
ni = dt.Rows.Count;

if (k==2) this.comboBox2.Items.Clear();
// if (k==3) this.comboBox3.Items.Clear();
if (k==4) this.comboBox4.Items.Clear();
// if (k==5) this.comboBox5.Items.Clear();

if ( ni>0)  
{
for(int i = 0; i< ni; i++ )
{
line = dt.Rows[i].ItemArray[0].ToString().Trim();
if (k==2) this.comboBox2.Items.Add(line);
// if (k==3) this.comboBox3.Items.Add(line);
if (k==4) this.comboBox4.Items.Add(line);
// if (k==5) this.comboBox5.Items.Add(line);
}
if (k==2 && this.comboBox2.Items.Count == 1) this.comboBox2.SelectedIndex=0;
// if (k==3 && this.comboBox3.Items.Count == 1) this.comboBox3.SelectedIndex=0;
if (k==4 && this.comboBox4.Items.Count == 1) this.comboBox4.SelectedIndex=0;
// if (k==5 && this.comboBox5.Items.Count == 1) this.comboBox5.SelectedIndex=0;
}
}
else initSys.TS_MessageBox("数据库访问错误!");
}
看不懂这段程序

解决方案 »

  1.   

    泛型
    具体请看http://book.csdn.net/bookfiles/30/10030857.shtml
      

  2.   

    这句么?if (k==4) dds = initSys.ws.GetMaterielPDMList("type <> '1'"); 是sql语句的一部分吧,<>表示不等于
      

  3.   

    主要把数据通过this.comboBox0.Items.Add(line); 来添加到下拉框中。其他就是对相关数据进行操作咯,还有那个<>没什么,initSys.ws.GetMaterielPDMList("type <> '1'"); 中是GetMaterielPDMList这个方法的一个字串参数
      

  4.   

    就你的代码,那是表示不等于的意思。
    还有另一个意思,在<>之间加入类型参数,如<int>,这是有关泛型方面的知识。
      

  5.   

    type <> '1'是传入的字符串参数,是SQL语句的一部分
      

  6.   

    在LZ的代码中,应该按照SQL中<>来理解,表示不等于
      

  7.   

    同意楼上:
    ("type <> '1'")表示
    type不等于'1'
      

  8.   

    SQL语句,不等于吧
    最好看看initSys.ws.GetMaterielPDMList这个方法的代码
      

  9.   

    没看懂意思,
    不过除了泛型,或者SQL语句,不可能有其他!
    不然就错了!