在c#中“ <>” 代表什么意思?
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("数据库访问错误!");
}
看不懂这段程序
[解决办法]
哪句不懂
[解决办法]
泛型吧
[解决办法]
泛型
具体请看http://book.csdn.net/bookfiles/30/10030857.shtml
[解决办法]
这句么?if (k==4) dds = initSys.ws.GetMaterielPDMList("type <> '1'");
是sql语句的一部分吧,<>表示不等于
[解决办法]
具体点
[解决办法]
主要把数据通过this.comboBox0.Items.Add(line); 来添加到下拉框中。其他就是对相关数据进行操作咯,还有那个<>没什么,initSys.ws.GetMaterielPDMList("type <> '1'"); 中是GetMaterielPDMList这个方法的一个字串参数
[解决办法]
就你的代码,那是表示不等于的意思。
还有另一个意思,在<>之间加入类型参数,如<int>,这是有关泛型方面的知识。
[解决办法]
有两种,一种是不等于,一种表示泛型
[解决办法]
type <> '1'是传入的字符串参数,是SQL语句的一部分
[解决办法]
[解决办法]
有两种,一种是不等于,一种表示泛型,学习中.