
我也想知道,取到的值,如何调用,我是想验证一下取的值里有没有我要的值,想在SQL语句外加个 if 判断,这个select是在函数里用的,因为没得到相应的结果,不知道是哪儿出的问题,想用if判断一下这个值取到没有,如何处理,谢谢!代码如下(---后面是个判断,不知对否):
set HyTRs=nothing
set HyTRs=serverCreateObject("adodbrecordset")
sql = "select from HyClub where KeyString like '" & KeyString & "%' and KeyString<>'"&KeyString&"' and IsApproved=true"
HyTRsOpen sql,conn
if HyTRsRecordCount>0 then '如果有此number
Do While Not HyTRseof
ind = len(HyTRs("KeyString")) - len(KeyString)
if ind <= 5 then
user = CFANDPD(HyTRs("HyNumber"))‘----调用一个函数
‘------------------------
if HyNumber="CF60016811" then
responsewrite("---------222222--------无痕秋水"&user&"长度差"&ind)
end if
请指教,谢谢!
已经搞定,我写的还是对的:)
楼主可以用我这个方法 HyNumber就是结果集中的,直接用字段名就可以调用!
jQuery获取Select元素,并设置的 Text和Value:
$("#select_id ")get(0)selectedIndex=1; //设置Select索引值为1的项选中
$("#select_id ")val(4); // 设置Select的Value值为4的项选中
$("#select_id option[text='jQuery']")attr("selected", true); //设置Select的Text值为jQuery的项选中
jQuery添加/删除Select元素的Option项:
$("#select_id")append("<option value='Value'>Text</option>"); //为Select追加一个Option(下拉项)
$("#select_id")prepend("<option value='0'>请选择</option>"); //为Select插入一个Option(第一个位置)
$("#select_id option:last")remove(); //删除Select中索引值最大Option(最后一个)
$("#select_id option[index='0']")remove(); //删除Select中索引值为0的Option(第一个)
$("#select_id option[value='3']")remove(); //删除Select中Value='3'的Option
$("#select_id option[text='4']")remove(); //删除Select中Text='4'的Option
三级分类 <select name="thirdLevel" id="thirdLevel"
onchange="getFourthLevel()">
<option value="0" id="thirdOption">
请选择三级分类
</option>
</select>
</div>
四级分类:
<select name="fourthLevelId" id="fourthLevelId">
<option value="0" id="fourthOption">
请选择四级分类
</option>
</select>
</div>
if($("#thirdLevel")val()!=0){
$("#thirdLevel option[value!=0]")remove();
}
if($("#fourthLevelId")val()!=0){
$("#fourthLevelId option[value!=0]")remove();
}//这个表示:假如希望当选择选择第三类时:如果第四类中有数据则删除,如果没有数据第四类的商品中的为默认值。
获取Select :
获取select 选中的 text :
$("#ddlRegType")find("option:selected")text();
获取select选中的 value:
$("#ddlRegType ")val();
获取select选中的索引:
$("#ddlRegType ")get(0)selectedIndex;
设置select:
设置select 选中的索引:
$("#ddlRegType ")get(0)selectedIndex=index;//index为索引值
那么这个select所有option的集合是:var options = documentgetElementByIdx_x_x("select1")options;即可获取既然可以获取到option集合,那每一个option的value就不言而喻了。比如select中第一个选项的value为 var option_value1 = documentgetElementByIdx_x_x("select1")options[0]value;交换两个option的值(和名称)的方式也很简单。比如这个select的有两个option,分别是<option value="1">1</option>和<option value="2">2</option>,现在交换两个option的位置(即交换值(名称))。
在jsp页面中通过form的得到的select标签的值,form提交给自身页面,然后通过requestgetParameter()方法取得值
测试代码如下(文件名为:testselectjsp):
<%@ page language=java import=javautil pageEncoding=GB18030%<%requestsetCharacterEncoding(GB18030);//加上这一句解决的
String path = requestgetContextPath();
String basePath = requestgetScheme() + ://
+ requestgetServerName() + : + requestgetServerPort()
+ path + /;
//存放下来菜单对应值的数组
ArrayList nu = new ArrayList();
nuadd(一);
nuadd(二);
nuadd(三);%<!DOCTYPE HTML PUBLIC -//W3C//DTD HTML 401 Transitional//EN<html<head<base href=<%=basePath%
<titleMy JSP 'testselectjsp' starting page</title</head<body通过requestgetParameter(number)方法取得下拉框选取的值
<form method=post action=testselectjsp <!-- 提交给自身 --
<select name=number<%for (int i = 0; i < nusize(); i++) {
outprint(<option + nuget(i) + </option);}%</select
<input type=submit value=提交 name=submit</form</body<%//取得提交的数字,并显示
outprint(选的值是: + n);%</html运行界面:
你的意思就是说从表单里的SELECT下拉菜单选出要选择的项,直接按提交,从接收页面接收到你所选的下拉项,通过连接数据库,查询出需要查询的结果呗。。。
你上面的例子中,在接收页通过requestquerystring("id")这个方法就可以从接收页接收到id的值,这个你应该知道吧。
同样你给select一个name属性值,在接收页通过name=requestfrom("name属性值")就可以吧select下拉列表所选中的值传递到接收页。
最后就是通过ADODB方式连接数据库,
select
from
表明
where
大类=name
明白了吧。
以上就是关于怎么获取sql中select里面的值全部的内容,包括:怎么获取sql中select里面的值、如何获取select 里option的值、如何获取select的option的value值等相关内容解答,如果想了解更多相关内容,可以关注我们,你们的支持是我们更新的动力!
欢迎分享,转载请注明来源:内存溢出
微信扫一扫
支付宝扫一扫
评论列表(0条)