排序问题?高分
<%'翻页的链接后缀
Function getGoString(nGoPage)
dim szReturn
szReturn=ParamGet()
szReturn=szReturn & "&PageSize=" & nPageSize
szReturn=szReturn & "&CurrPage=" & nGoPage
getGoString=szReturn
End Function
'翻页的链接后缀
Function getTurnString()
dim szReturn
szReturn=ParamGet()
szReturn=szReturn & "&CurrPage="
getTurnString=szReturn
End Function
Function ParamGet()
dim szReturn
szReturn="&A=A"
if len(Skey)<>0 then szReturn=szReturn & "&Skey=" & Skey
if len(InfTypeID)<>0 then szReturn=szReturn & "&InfTypeID=" & InfTypeID
if left(szReturn,1)="&" then szReturn=right(szReturn,len(szReturn)-1)
ParamGet=szReturn
End function
function CharFromA(varInt)
if CInt(varInt)<=25 then
CharFromA=chr(Asc("A")+varInt)
else
CharFromA=CStr(varInt-25)
end if
End function
Dim szSQL,oRst
set oRst=Server.CreateObject("AdoDb.recordset")
Set oRstCX = Server.CreateObject("ADODB.Recordset")
const cnstCountPL=1 '每行现实数
nPageSize=Request("PageSize")'每页显示数
nCurrPage=Request("CurrPage")'当前页数
if len(nPageSize)=0 then nPageSize=14 '默认显示15条
if len(nCurrPage)=0 then nCurrPage=1 '默认第一页
if Cint(nCurrPage)<=0 then nCurrPage=1
InfTypeID=request("InfTypeID")
key=request("key")
if len(InfTypeID)=0 then InfTypeID="174"'默认最新报道
szSQL="Select * from tSysDateCode where Dco_ID="&InfTypeID
oRst.Open szSQL,conn,1,1
if not oRst.Eof then
InfTypeName=oRst("Dco_NameCn")
end if
oRst.Close
szSQL="Select * from tInformation where Inf_Lanage='CN' and Inf_TypeID="&InfTypeID
if len(key)>0 then
szSQL="Select * from tInformation where Inf_Title like '%"&key&"%'"
end if
'response.write(szSQL)
'排序字段
szOderFields=Request("OrderFilds")
'if len(szOderFields)=0 then szOderFields=" Inf_Order "
'升序降序
szAscOrDesc=Request("AscOrDesc")
szAscOrDesc="Desc"
'if len(szAscOrDesc)=0 then
'szAscOrDesc="Desc"
'end if
'组合SQL
szSQL=szSQL& " order by "& szOderFields & " " & szAscOrDesc &" "
response.Write(szSQL&"<BR>")
'response.End()
'执行SQL
oRst.Open szSQL,conn,1,1 '出行提示出错
if not oRst.Eof then
oRst.PageSize=nPageSize
nTotalPages=oRst.PageCount
nTotalItems=oRst.RecordCount
if Cint(nCurrPage) > nTotalPages then nCurrPage=nTotalPages '超出总页数
oRst.AbsolutePage=nCurrPage
else
nTotalPages=0
nTotalItems=0
end if
if int(nCurrPage) > nTotalPages then nCurrPage=nTotalPages '超出总页数
dim szModelLine
dim realcar
nIterator=0
dim pp
'显示条转页下拉
for pp=1 to nTotalPages
if Cint(nCurrPage)=pp then
pageNo_Str=pageNo_Str&"<option value="&pp&" selected >"&pp&"</option>"
else
pageNo_Str=pageNo_Str&"<option value="&pp&" >"&pp&"</option>"
end if
next
'显示每页显示下拉
for pp=10 to 50 Step 10
if Cint(nPageSize)=pp then
pageSize_Str=pageSize_Str & "<option value="&pp&" selected>"&pp&"</option>"
else
pageSize_Str=pageSize_Str & "<option value="&pp&">"&pp&"</option>"
end if
'pp=pp+10
next
%>
出错提示内容
Microsoft VBScript 编译器错误 错误 '800a03f6'
缺少 'End'
/iisHelp/common/500-100.asp,行242
Microsoft JET Database Engine 错误 '80040e14'
ORDER BY 子句语法错误。
/03news/index.asp,行77
请问是哪里有问题 --------------------编程问答-------------------- 把sql打出来看看才知道. --------------------编程问答-------------------- 有可能是 order by 后面的字段是空.... --------------------编程问答-------------------- %
'翻页的链接后缀
Function getGoString(nGoPage)
dim szReturn
szReturn=ParamGet()
szReturn=szReturn & "&PageSize=" & nPageSize
szReturn=szReturn & "&CurrPage=" & nGoPage
getGoString=szReturn
End Function
'翻页的链接后缀
Function getTurnString()
dim szReturn
szReturn=ParamGet()
szReturn=szReturn & "&CurrPage="
getTurnString=szReturn
End Function
Function ParamGet()
dim szReturn
szReturn="&A=A"
if len(Skey)<>0 then szReturn=szReturn & "&Skey=" & Skey
if len(InfTypeID)<>0 then szReturn=szReturn & "&InfTypeID=" &
InfTypeID
if left(szReturn,1)="&" then
szReturn=right(szReturn,len(szReturn)-1)
ParamGet=szReturn
End function
function CharFromA(varInt)
if CInt(varInt)<=25 then
CharFromA=chr(Asc("A")+varInt)
else
CharFromA=CStr(varInt-25)
end if
End function
Dim szSQL,oRst
set oRst=Server.CreateObject("AdoDb.recordset")
Set oRstCX = Server.CreateObject("ADODB.Recordset")
const cnstCountPL=1 '每行现实数
nPageSize=Request("PageSize")'每页显示数
nCurrPage=Request("CurrPage")'当前页数
if len(nPageSize)=0 then nPageSize=14 '默认显示15条
if len(nCurrPage)=0 then nCurrPage=1 '默认第一页
if Cint(nCurrPage)<=0 then nCurrPage=1
InfTypeID=request("InfTypeID")
key=request("key")
if len(InfTypeID)=0 then InfTypeID="174"'默认最新报道
szSQL="Select * from tSysDateCode where Dco_ID="&InfTypeID
oRst.Open szSQL,conn,1,1
if not oRst.Eof then
InfTypeName=oRst("Dco_NameCn")
end if
oRst.Close
szSQL="Select * from tInformation where Inf_Lanage='CN' and
Inf_TypeID="&InfTypeID
if len(key)>0 then
szSQL="Select * from tInformation where Inf_Title like '%"&key&"%'"
end if
response.write(szSQL)
'排序字段
szOderFields=Request("OrderFilds")
if len(szOderFields)=0 then szOderFields=" Inf_Order " '升序降序
'szAscOrDesc=Request("AscOrDesc")
szAscOrDesc="Asc"
'if len(szAscOrDesc)=0 then
'szAscOrDesc="Desc"
'end if
'组合SQL
szSQL=szSQL& " order by "& szOderFields & " " & szAscOrDesc &" "
response.Write(szSQL&"<BR>") 'response.End()
'执行SQL
oRst.Open szSQL,conn,1,1
if not oRst.Eof then
oRst.PageSize=nPageSize
nTotalPages=oRst.PageCount
nTotalItems=oRst.RecordCount
if Cint(nCurrPage) > nTotalPages then nCurrPage=nTotalPages '超出总
页数
oRst.AbsolutePage=nCurrPage
else
nTotalPages=0
nTotalItems=0
end if
if int(nCurrPage) > nTotalPages then nCurrPage=nTotalPages '超出总页数
dim szModelLine
dim realcar
nIterator=0
dim pp
'显示条转页下拉
for pp=1 to nTotalPages
if Cint(nCurrPage)=pp then
pageNo_Str=pageNo_Str&"<option value="&pp&" selected
>"&pp&"</option>"
else
pageNo_Str=pageNo_Str&"<option value="&pp&" >"&pp&"</option>"
end if
next
'显示每页显示下拉
for pp=10 to 50 Step 10
if Cint(nPageSize)=pp then
pageSize_Str=pageSize_Str & "<option value="&pp&"
selected>"&pp&"</option>"
else
pageSize_Str=pageSize_Str & "<option
value="&pp&">"&pp&"</option>"
end if
'pp=pp+10
next
%>
显示打出来的SZSQL内容:
Select * from tInformation where Inf_Lanage='CN' and Inf_TypeID=174Select * from tInformation where Inf_Lanage='CN' and Inf_TypeID=174 order by Inf_Order Asc
问题补充:
新闻添加到16条时就出问题,顺序全乱了.
发布15条新闻以内就不会出问题.(顺序没错)
--------------------编程问答-------------------- if len(szOderFields)=0 then szOderFields=" Inf_Order " '升序降序
把这一行改回来后,就不会出现提示出错的问题,
问题补充:
新闻添加到16条时就出问题,顺序全乱了.
发布15条新闻以内就不会出问题.(顺序没错) --------------------编程问答-------------------- 哇靠,asp代码。 --------------------编程问答-------------------- 那是因为你只显示15条.
你这个问题是SQL出错引起的。你应该在出错的时候,将SQL打出来看看,你就知道什么地方错了.
补充:.NET技术 , ASP.NET