ASP 搜索代码解释
ASP连接数据裤之后的搜索代码sql1="select*fromlinkwherelink_id="&trim(request("link_id"))sql2="sele...
ASP连接数据裤之后的搜索代码
sql1="select * from link where link_id="&trim(request("link_id"))
sql2="select * from link where webName='"&trim(request("webName"))&"'"
为什么两句代码where后面的格式不同呢,是因为link_id和WebName的数据类型不一样的嘛?
那我要是想把两个条件整合一起应该怎么写呢?是这样子的嘛?
sql="select * from link where link_id="&trim(request("link_id")) "and webName='"&trim(request("webName"))&"'" 展开
sql1="select * from link where link_id="&trim(request("link_id"))
sql2="select * from link where webName='"&trim(request("webName"))&"'"
为什么两句代码where后面的格式不同呢,是因为link_id和WebName的数据类型不一样的嘛?
那我要是想把两个条件整合一起应该怎么写呢?是这样子的嘛?
sql="select * from link where link_id="&trim(request("link_id")) "and webName='"&trim(request("webName"))&"'" 展开
2个回答
展开全部
整合条件语句要看你的条件关系了
如果你是想两个结果的合集,就用or,
sql="select * from link where link_id="&trim(request("link_id")) " and webName='"&trim(request("webName"))&"'"
如果是想要两个结果的交集,就用and
sql="select * from link where link_id="&trim(request("link_id")) " and webName='"&trim(request("webName"))&"'"
拼sql语句,空格和引号是关键
如果你是想两个结果的合集,就用or,
sql="select * from link where link_id="&trim(request("link_id")) " and webName='"&trim(request("webName"))&"'"
如果是想要两个结果的交集,就用and
sql="select * from link where link_id="&trim(request("link_id")) " and webName='"&trim(request("webName"))&"'"
拼sql语句,空格和引号是关键
展开全部
// JavaScript Document
var xmlHttp = false;
try {
xmlHttp = new ActiveXObject("Msxml2.XMLHTTP");
} catch (e) {
try {
xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
} catch (e2) {
xmlHttp = false;
}
}
if (!xmlHttp && typeof XMLHttpRequest != "undefined") {
xmlHttp = new XMLHttpRequest();
}
function changeselect(ChannelID){
document.getElementById("status").style.display="inline";
try{
//var userObj = document.getElementById(ChannelID);
var url = "product_add_change.asp?ChannelID=" +escape(ChannelID);
xmlHttp.open("GET", url, true);
xmlHttp.onreadystatechange = checkUserOk;
xmlHttp.send(null);
}catch(exception){
alert(exception.description);
}
}
function checkUserOk(){
if (xmlHttp.readyState == 4) {
try{
var response = xmlHttp.responseText;
var alertObj = document.getElementById("product0");
if(response !== null){
alertObj.innerHTML=response;
}
document.getElementById('status').style.display='none';
}catch(exception){
alert(exception.description);
}
}
}
<%
function product_list(ChannelID)
Response.Expires = -1
Response.ExpiresAbsolute = Now() - 1
Response.cachecontrol = "no-cache"
for i= 3 to len(ChannelID)+3 step 3
set rs_true=server.createobject("adodb.recordset")
sql="select ChannelID,classname from product_class where ChannelID like'"&left(ChannelID,i-3)&"___'"
'response.Write(sql)
rs_true.open sql,conn,1,1
if not rs_true.eof then
backStr=backStr&"<select name='product_class' id='product_class' onChange=changeselect(this.value) dataType='Require' msg='请选择分类'> "
backStr=backStr&"<option value='"&left(ChannelID,i-3)&"' class='red_bold'>请选择分类</option>"
do while not rs_true.eof
backStr=backStr&"<option value="&rs_true("ChannelID")
if rs_true("ChannelID")=left(ChannelID,i) then
backStr=backStr&" selected "
end if
backStr=backStr&">"&rs_true("classname")&"</option>"
rs_true.movenext
loop
backStr=backStr&"</select>"
rs_true.close
set rs_true=nothing
end if
next
backStr=backStr&"<input name='ChannelID' type='hidden' id='ChannelID' value='"&ChannelID&"' />"
product_list = backStr 'return error code
end function
%>
var xmlHttp = false;
try {
xmlHttp = new ActiveXObject("Msxml2.XMLHTTP");
} catch (e) {
try {
xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
} catch (e2) {
xmlHttp = false;
}
}
if (!xmlHttp && typeof XMLHttpRequest != "undefined") {
xmlHttp = new XMLHttpRequest();
}
function changeselect(ChannelID){
document.getElementById("status").style.display="inline";
try{
//var userObj = document.getElementById(ChannelID);
var url = "product_add_change.asp?ChannelID=" +escape(ChannelID);
xmlHttp.open("GET", url, true);
xmlHttp.onreadystatechange = checkUserOk;
xmlHttp.send(null);
}catch(exception){
alert(exception.description);
}
}
function checkUserOk(){
if (xmlHttp.readyState == 4) {
try{
var response = xmlHttp.responseText;
var alertObj = document.getElementById("product0");
if(response !== null){
alertObj.innerHTML=response;
}
document.getElementById('status').style.display='none';
}catch(exception){
alert(exception.description);
}
}
}
<%
function product_list(ChannelID)
Response.Expires = -1
Response.ExpiresAbsolute = Now() - 1
Response.cachecontrol = "no-cache"
for i= 3 to len(ChannelID)+3 step 3
set rs_true=server.createobject("adodb.recordset")
sql="select ChannelID,classname from product_class where ChannelID like'"&left(ChannelID,i-3)&"___'"
'response.Write(sql)
rs_true.open sql,conn,1,1
if not rs_true.eof then
backStr=backStr&"<select name='product_class' id='product_class' onChange=changeselect(this.value) dataType='Require' msg='请选择分类'> "
backStr=backStr&"<option value='"&left(ChannelID,i-3)&"' class='red_bold'>请选择分类</option>"
do while not rs_true.eof
backStr=backStr&"<option value="&rs_true("ChannelID")
if rs_true("ChannelID")=left(ChannelID,i) then
backStr=backStr&" selected "
end if
backStr=backStr&">"&rs_true("classname")&"</option>"
rs_true.movenext
loop
backStr=backStr&"</select>"
rs_true.close
set rs_true=nothing
end if
next
backStr=backStr&"<input name='ChannelID' type='hidden' id='ChannelID' value='"&ChannelID&"' />"
product_list = backStr 'return error code
end function
%>
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询