سوال در مورد نشان يك تعداد ركودر در صفحه

cactus

Member
من ميخوام تعداد ركورهاي كه در هر دفته لود ميشه فقط 5 تا باشه
و با هر با كليك كردن رو دكمه next بقيه ركوردها را بصورت 5 تا 5 تا بياره

كد كانكشن من به شكل زير هست

[/quote]


[TheDatabaseFile = ".\db\News.mdb"
set OpenDatabase = server.createobject("adodb.connection")
OpenDatabase.Open "DRIVER={Microsoft Access Driver (*.mdb)}; " & "DBQ=" & server.mappath ( TheDatabaseFile )
sqlquery = "SELECT * FROM NwsTyp inner join Nws on Nws.NwsTypIdn=NwsTyp.NwsTypIdn Order By NwsDte"

set ResultSet = OpenDatabase.execute( sqlquery )
do until ResultSet.eof %>
<table width="97%" border="0" cellspacing="1" cellpadding="1" dir=rtl>
<tr>
<td class=Auto>

<div align="right"><font size="2" color="#000066"><a href=javascript:news()>
<font size="2" color="#000066"><font color="#000099"><%=ResultSet("NwsTtl")%></font></font><font color="#000099">
</font></a> </font></div>
</td>
</tr>
</table>
<%
ResultSet.movenext
loop

ResultSet.close
set ResultSet = nothing
OpenDatabase.close
set OpenDatabase = nothing
%>
 

AliReza26

Active Member
بفرما....

در ضمن اين تاپيك را شما بايد در انجمن Server Side باز مي كرديد....

کد:
<%
TheDatabaseFile = ".\db\News.mdb" 
set OpenDatabase = server.createobject("adodb.connection") 
OpenDatabase.Open "DRIVER={Microsoft Access Driver (*.mdb)}; " & "DBQ=" & server.mappath ( TheDatabaseFile ) 
sqlquery = "SELECT * FROM NwsTyp inner join Nws on Nws.NwsTypIdn=NwsTyp.NwsTypIdn Order By NwsDte" 

set ResultSet = OpenDatabase.execute( sqlquery ) 

if NOT request.querystring("np") = "" then
    for imove = 1 to request.querystring("np")
      ResultSet.move(Cint(request.querystring("np"))
    next
  end if

do until (ResultSet.eof and ipage > 5 )
%> 
<table width="97%" border="0" cellspacing="1" cellpadding="1" dir=rtl> 
<tr> 
<td class=Auto> 

<div align="right"><font size="2" color="#000066"><a href=javascript:news()> 
<font size="2" color="#000066"><font color="#000099"><%=ResultSet("NwsTtl")%></font></font><font color="#000099"> 
</font></a> </font></div> 
</td> 
</tr> 
</table> 
<% 
ResultSet.movenext 
ipage = ipage + 1
loop 

ResultSet.close 
set ResultSet = nothing 
OpenDatabase.close 
set OpenDatabase = nothing 

if ipage > 5 then
  response.write("<a href="YourpageName.asp?np=" & request.querystring("np") + ipage & ">Next page")
end if

if NOT request.querystring("np") = "" then
  response.write("<a href="YourpageName.asp?np=" & request.querystring("np") + ipage & ">Next page")
end if
%>
 

cactus

Member
از لطف شما متشكرم

ولي در هنگام اجرا شدن برنامه خطاي زير داده ميشود

[align=left:2cbeeea6c3]
Technical Information (for support personnel)

Error Type:
Microsoft VBScript compilation (0x800A03EE)
Expected ')'
/rac17/rac24/rac23/Copy of index.asp, line 11, column 46
ResultSet.move(Cint(request.querystring("np"))
---------------------------------------------^


Browser Type:
Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0)

Page:
GET /rac17/rac24/rac23/Copy of index.asp

Time:
2004/09/18, 09:41:40 ق.ظ


More information:
Microsoft Support [/align:2cbeeea6c3]
 

AliReza26

Active Member
اصلاح شد :

کد:
<% 
TheDatabaseFile = ".\db\News.mdb" 
set OpenDatabase = server.createobject("adodb.connection") 
OpenDatabase.Open "DRIVER={Microsoft Access Driver (*.mdb)}; " & "DBQ=" & server.mappath ( TheDatabaseFile ) 
sqlquery = "SELECT * FROM NwsTyp inner join Nws on Nws.NwsTypIdn=NwsTyp.NwsTypIdn Order By NwsDte" 

set ResultSet = OpenDatabase.execute( sqlquery ) 

if NOT request.querystring("np") = "" then 
    for imove = 1 to request.querystring("np") 
     ResultSet.move(Cint(request.querystring("np"))) 
    next 
  end if 

do until (ResultSet.eof and ipage > 5 ) 
%> 
<table width="97%" border="0" cellspacing="1" cellpadding="1" dir=rtl> 
<tr> 
<td class=Auto> 

<div align="right"><font size="2" color="#000066"><a href=javascript:news()> 
<font size="2" color="#000066"><font color="#000099"><%=ResultSet("NwsTtl")%></font></font><font color="#000099"> 
</font></a> </font></div> 
</td> 
</tr> 
</table> 
<% 
ResultSet.movenext 
ipage = ipage + 1 
loop 

ResultSet.close 
set ResultSet = nothing 
OpenDatabase.close 
set OpenDatabase = nothing 

if ipage > 5 then 
  response.write("<a href="YourpageName.asp?np=" & request.querystring("np") + ipage & ">Next page") 
end if 

if NOT request.querystring("np") = "" then 
  response.write("<a href="YourpageName.asp?np=" & request.querystring("np") + ipage & ">Next page") 
end if 
%>
 

cactus

Member
آقا رضا باز هم كدي شما دادين جواب نداد من فايل و بانك را براي شما ارسال مي كنم
اگر براي شما امكان دارد آن را چك نماييد.

يك سوال ديگر هم داشتم اگر بخواهم فقط 5 ركورد آخر را نشان دهد چكار بايد بكنم


Error Type:
Microsoft VBScript compilation (0x800A03EE)
Expected ')'
/New Folder/news2.asp, line 38, column 25
response.write("<a href="YourpageName.asp?np=" & request.querystring("np") + ipage & ">Next page")
------------------------^
 

جدیدترین ارسال ها

بالا