کمک!!!!

zorig4fun

Member
سلام
من اين کدها را دارم
کد:
<table class="tableRow">
	        <%    		

		'Do....While Loop to loop through the recorset to display the Artist
		Do While iArtistCount2 > 10

			'If there are no Song2's records left to display then exit loop
			If iArtistCount2 >= 0 Then Exit Do
			

			'Read in the profile from the recordset
			lngArtistID2 = CLng(sarryArtist2(0,iArtistCount2))
			strArtistName2 = sarryArtist2(4,iArtistCount2)
			


			'Write the HTML of the Topic descriptions as hyperlinks to the Topic details and message
			%>
 <tr class="tableRow">
  <td width="10%" height="1%" align="right"><% = iArtistCount2 +1 %>: </td>
  <td width="100%" height="1%" align="left"><a href="artist_profile.asp?APF=<% = lngArtistID2 %>"><% = strArtistName2 %></a></td>
 </tr>
<%
			
			'Move to the next record
			iArtistCount2 = iArtistCount2 + 1
					
		'Loop back round
		Loop

			%>
  </table>
حالا ميخوام طوری اينها را دستکاری کنم که اگر در iArtistCount2 رکردی وجود نداره بنويسه comming Soon البته اين کد ۱۰ تا ريکرد اول را مينويسه و اگر فرض ۵ تا ريکرد باشه ۵ تا رو هم بنويسه و بقيه ۵ تا را comming Soon بنويسه.
مرسی
 

m1pfard

Member
اینطوری چطوره؟:

[LTR]
کد:
<table class="tableRow">
<%    		
'------------------------       انتخاب 10 رکورد آخر به ترتیب تاریخ اضافه شدن   -----------------
strArtistSQL = "SELECT TOP 10 * FROM tblYourTable  ORDER BY Add_Date DESC;"
Set rsArtist = Server.CreateObject("ADODB.Recordset")
rsArtist.Open strArtistSQL , adoCon1 ,1,1


		'-------------- FOR -------------------
		For iArtistCount2 = 1 to 10
		
			If rsArtist.EOF Then 
					'---------------  ! داده ای وجود ندارد   ----------------
					lngArtistID2 = 0
					strArtistName2 = "Comming Soon!"
			ELSE
					'--------------      خواندن داده ها از دیتابیس    ------------
					lngArtistID2 = CLng(rsArtist("Artist_ID")
					strArtistName2 = rsArtist ("Artist_Name")
			END IF			
			

			'Write the HTML of the Topic descriptions as hyperlinks to the Topic details and message
			%>
			<tr class="tableRow">
				<td width="10%" height="1%" align="right"><% = iArtistCount2 +1 %>: </td>
				<td width="100%" height="1%" align="left">
				<a href="artist_profile.asp?APF=<% = lngArtistID2 %>"><% = strArtistName2 %></a></td>
			</tr>
			<%
			rsArtist .MoveNext
		Next
		'------------ END FOR  -------------------
		

			%>
</table>
[/LTR]
 

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

بالا