Topic: 请教(谢谢) (Incompatible type for switch)

  Print this page

1.请教(谢谢) (Incompatible type for switch) Copy to clipboard
Posted by: YoYo
Posted on: 2004-08-20 12:30

我的代码是:
shenhe=request.getParameter("checkCard");
type=request.getParameter("cxtj_zd");
fuhao=request.getParameter("cxtj_fh");
key=request.getParameter("cxtj_value");
sql="select * from add_new_huiyuan ";
switch(shenhe){
case 1:sql+="where" +type +fuhao+ "and" +"shenhe='已审核'";
case 2:sql+="where" +type +fuhao+ "and" +"shenhe='未审核'";
}

错误提示是:Incompatible type for switch. Can't convert java.lang.String to int.
   switch(shenhe){

我是个新手,对列表框不怎么了解。我的一个列表框的代码如下:
<select name="checkCard">
<option value=1 selected >已审核</option>
<option value=0 >未审核</option>
</select>

请问:此列表框的返回值是什么类型的?

谢谢指点!!!!!!!


{ 请尽量用准确的文字描述作为标题 }

2.Re:请教(谢谢) [Re: YoYo] Copy to clipboard
Posted by: nothing
Posted on: 2004-08-20 12:35

1 or 0 ?

3.Re:请教(谢谢) [Re: YoYo] Copy to clipboard
Posted by: scud
Posted on: 2004-08-20 13:00

先转换为int

4.Re:请教(谢谢) [Re: YoYo] Copy to clipboard
Posted by: gary31
Posted on: 2004-08-20 14:15

返回的值当然会是String型的,
要用switch,就得要先把值转换为int或chat
就不会出现你说的错误了

5.Re:请教(谢谢) (Incompatible type for switch) [Re: YoYo] Copy to clipboard
Posted by: YoYo
Posted on: 2004-08-20 23:43

谢谢各位大侠指点


   Powered by Jute Powerful Forum® Version Jute 1.5.6 Ent
Copyright © 2002-2021 Cjsdn Team. All Righits Reserved. 闽ICP备05005120号-1
客服电话 18559299278    客服信箱 714923@qq.com    客服QQ 714923