作者linus (羽调--奈勒斯)
看板C_Sharp
标题[问题] .RecordCount
时间Fri Jun 10 20:01:02 2005
用ASP.Net写的一个.aspx档, 为什麽在用了 .RecordCount
成功在网页上秀出有几笔资料库的资料....
但在页面本身的程式中....
要用它来当判断式的条件却无法使用??
举例....
网页程式开头前略...
<MM:DataSet
id="RsBidList"
runat="Server"
IsStoredProcedure="false"
ConnectionString='<%# System.Configuration.ConfigurationSettings.
AppSettings("MM_CONNECTION_STRING_MultipleAuction") %>'
DatabaseType='<%# System.Configuration.ConfigurationSettings.
AppSettings("MM_CONNECTION_DATABASETYPE_MultipleAuction") %>'
CommandText='<%# "SELECT * FROM dbo.EnglishBidView WHERE ProductID = ?
ORDER BY BidPrice desc" %>'
CurrentPage='<%# IIf((Request.QueryString("RsBidList_CurrentPage")
<> Nothing), Request.QueryString("RsBidList_CurrentPage"), 0) %>'
PageSize="12"
Debug="true"
>
中略....
<script runat="server">
略....
Sub Page_Load(Src As Object, E As EventArgs)
略.....
if RsBidList.RecordCount = 0 then
if trim(OnlineBid.text)="" then
Response.write("<Script language=""JavaScript""> alert(""error"");
</" & "Script>")
exit sub
else
if cint(OnlineBid.text)<BegingBid_first then
略.....
else if .... then
略....
</script>
<p align="center">共<%= RsBidList.RecordCount %>笔资料</p>
前面黄色那段判断式...不管RsBidList.RecordCount为0或其他数...
都一定会执行蓝色那段跳出error,
但後面用了红色那段确能在页面上正确显示有几笔资料....
0就显示0, 1就显示1, 2就显示2.....
可是当显示1,2,3.... etc 非0 的时候....
不管怎麽操作都还是会去执行蓝色那段判断....
感觉黄色那个判断式好像一点用都没有....为什麽呢??
如果要让黄色那段判断式有用(RecordCount=0就进入, 否则跳到else)...
改怎麽写呢....?? 谢谢....
--
※ 发信站: 批踢踢实业坊(ptt.cc)
◆ From: 163.22.22.88
※ 编辑: linus 来自: 163.22.22.88 (06/10 20:01)
※ 编辑: linus 来自: 163.22.22.88 (06/10 20:02)