asp 数据库操作
<%min=request.querystring("min")max=request.querystring("max")setconn=server.createob...
<%
min=request.querystring("min")
max=request.querystring("max")
set conn=server.createobject("adodb.connection")
conn.open "driver={microsoft access driver (*.mdb)};dbq="&server.mappath("DB.mdb")
sql="select * from ABC where value>'%min%' and value<'%max%'"
set rs=server.createobject("adodb.recordset")
rs.open sql,conn,1,1
%>
目的是达到在数据库中搜索value在x-xx之间的值,并把记录显示出来,请问怎么写? 展开
min=request.querystring("min")
max=request.querystring("max")
set conn=server.createobject("adodb.connection")
conn.open "driver={microsoft access driver (*.mdb)};dbq="&server.mappath("DB.mdb")
sql="select * from ABC where value>'%min%' and value<'%max%'"
set rs=server.createobject("adodb.recordset")
rs.open sql,conn,1,1
%>
目的是达到在数据库中搜索value在x-xx之间的值,并把记录显示出来,请问怎么写? 展开
3个回答
展开全部
value的类型是数字
<%
min=request.querystring("min")
max=request.querystring("max")
set conn=server.createobject("adodb.connection")
conn.open "driver={microsoft access driver (*.mdb)};dbq="&server.mappath("DB.mdb")
sql="select * from ABC where value>"&min&" and value<"&max
set rs=server.createobject("adodb.recordset")
rs.open sql,conn,1,1
if not (rs.eof and rs.bof) then
do while not rs.eof
'这里写输出的代码
rs.movenext
loop
end if
rs.close : set rs=nothing
<%
min=request.querystring("min")
max=request.querystring("max")
set conn=server.createobject("adodb.connection")
conn.open "driver={microsoft access driver (*.mdb)};dbq="&server.mappath("DB.mdb")
sql="select * from ABC where value>"&min&" and value<"&max
set rs=server.createobject("adodb.recordset")
rs.open sql,conn,1,1
if not (rs.eof and rs.bof) then
do while not rs.eof
'这里写输出的代码
rs.movenext
loop
end if
rs.close : set rs=nothing
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
<%
Dim sql,rs,conn
Dim Ary,i
min=request.querystring("min")
max=request.querystring("max")
set conn=server.createobject("adodb.connection")
conn.open "driver={microsoft access driver (*.mdb)};dbq="&server.mappath("DB.mdb")
set rs=server.createobject("adodb.recordset")
sql="select * from ABC where value>"&min&" and value<"&max&""
rs.open sql,conn,1,1
If Not rs.EOF Then
Ary = Rs.GetRows()
End If
rs.Close
Set rs = Nothing
conn.Close
Set conn = Nothing
'显示第一列的信息
If IsArray() Then
For i=0 To UBound(Ary,2)
response.write Ary(0,i) &"<br>"
Next
End If
%>
Dim sql,rs,conn
Dim Ary,i
min=request.querystring("min")
max=request.querystring("max")
set conn=server.createobject("adodb.connection")
conn.open "driver={microsoft access driver (*.mdb)};dbq="&server.mappath("DB.mdb")
set rs=server.createobject("adodb.recordset")
sql="select * from ABC where value>"&min&" and value<"&max&""
rs.open sql,conn,1,1
If Not rs.EOF Then
Ary = Rs.GetRows()
End If
rs.Close
Set rs = Nothing
conn.Close
Set conn = Nothing
'显示第一列的信息
If IsArray() Then
For i=0 To UBound(Ary,2)
response.write Ary(0,i) &"<br>"
Next
End If
%>
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询