All source code in ASP/ VbScript Ask a ASP/ VbScript Pro Discussion Forum Categories All jobs in ASP/ VbScript
Quick Search for:  in language:    
Showing,record,page,select,will,deleted
   Code/Articles » |  Newest/Best » |  Community » |  Jobs » |  Other » |  Goto » | 
CategoriesSearch Newest CodeCoding ContestCode of the DayAsk A ProJobsUpload
ASP/ VbScript Stats

 Code: 281,486. lines
 Jobs: 101. postings

 How to support the site

 
Sponsored by:

 
You are in:
 
Login

NEW! LEARNING CENTER
Special educational offers, white papers, webcasts, podcasts

  NEW! Download Rational Performance Tester V8 (download now)
  NEW! Download Rational Functional Tester V8 (download now)
  NEW! Download Rational Service Tester for SOA Quality V8 (download now)
  NEW! Teleconference: Quality In Action - Using Rational Quality Manager with Functional, Performance and Web Service Testing Products (download now)
  NEW! Introducing IBM Rational AppScan Developer Edition – easing security testing by non-security professionals (download now)

 

 


Latest postings for ASP/ VbScript.
Click here to see a screenshot of this code!Mess Officer Management System (Sistem Pengurusan Mess Pegawai)
By Mohd Fauzi on 11/23

(Screen Shot)

Click here to put this ticker on your site!


Add this ticker to your desktop!


Daily Code Email
To join the 'Code of the Day' Mailing List click here!



 
 
   

Showing & select record will be deleted per page

Print
Email
 
VB icon
Submitted on: 4/9/2002 1:10:26 AM
By: Akmal Rizal 
Level: Beginner
User Rating: By 1 Users
Compatibility:ASP (Active Server Pages)

Users have accessed this code 18993 times.
 
author picture
 
     Showing record by page and select record that will be deleted.
 
code:
Can't Copy and Paste this?
Click here for a copy-and-paste friendly version of this code!
 
Terms of Agreement:   
By using this code, you agree to the following terms...   
1) You may use this code in your own programs (and may compile it into a program and distribute it in compiled format for languages that allow it) freely and with no charge.   
2) You MAY NOT redistribute this code (for example to a web site) without written permission from the original author. Failure to do so is a violation of copyright laws.   
3) You may link to this code from another website, but ONLY if it is not wrapped in a frame. 
4) You will abide by any additional copyright restrictions which the author may have placed in the code or code's description.

    '**************************************
    ' Name: Showing & select record will be 
    '     deleted per page
    ' Description:Showing record by page and
    '     select record that will be deleted.
    ' By: Akmal Rizal
    '
    ' Assumes:User must know about ASP serve
    '     r object.
    '
    'This code is copyrighted and has    ' limited warranties.Please see http://w
    '     ww.Planet-Source-Code.com/vb/scripts/Sho
    '     wCode.asp?txtCodeId=7411&lngWId=4    'for details.    '**************************************
    
    <%
    if Not IsEmpty(Request.Form("cbDel")) Then
    	strTrans = trim(request.form("chkDel")) & ","
    	arrTrans = split(strTrans,",")
    	Set conn1 = server.createobject("ADODB.Connection")
    	'change With your own connection
    	conn1.open "my_conn",session("db_user"),session("db_pass")
    	For i = 0 To ubound(arrTrans) - 1
    		cKd=trim(arrTrans(i))
    		sql="delete my_article where art_id = '" & cKd & "'"
    		conn1.execute(sql)
    	Next
    	conn1.close
    	Set conn1=nothing 
    End if
    Set rs = Server.CreateObject("ADODB.RecordSet")
    fp_sQry= "Select * From my_article Order By art_name"
    cPass="DSN=my_conn;UID="+session("db_user")+";Password="+session("db_pass")
    rs.Open fp_sQry, cPass,1,1,1
    if request.querystring("mode")="next" Then
    startno=request.querystring("next")
    End if 
    if isempty(startno) Then
    startno=0
    End if
    recnum = rs.recordcount
    ' cari nomor halaman terakhir
    vendpage=recnum-(recnum mod 10)
    if recnum=vendpage Then
    	vendpage=vendpage-10
    End if	
    if recnum>0 Then
    	rs.movefirst
    End if	
    %>
    <HTML>
    <HEAD>
    <SCRIPT language="javascript">
    <!--
    	function CheckItem() {
    		if (! isNaN(frmpt.chkDel.length)) { 
    			For (var i=0; i<=frmpt.chkDel.length-1;++i) {
    				if (frmpt.chkDel[i].checked) return 1;
    			};
    		}
    		Else {
    			if (frmpt.chkDel.checked) return 1;
    		};
    		return 0
    	};
    	function ActionDel() {
    		if (CheckItem()) {
    			if(confirm("Selected records will be deleted. Are you sure?")) {
    				frmpt.cbDel.value="1";
    				frmpt.submit();
    			};
    		} Else {alert("No records selected!")};
    	};	
    //-->
    </SCRIPT>
    <TITLE>Article</TITLE>
    </HEAD>
    <BODY topmargin=0>
    <TABLE width="100%" border="0" cellspacing="0" cellpadding="0">
    <TR>
    <TD width="26%"> </TD>
    <TD width="46%"> 
    <DIV align="center"><FONT face="Verdana, Arial, Helvetica, sans-serif" size="5"><B>Article</B></FONT></DIV>
    </TD>
    <TD width="28%" align="right" valign="top"></TD>
    </TR>
    </TABLE>
    <FORM method="POST" action="mnt_art.asp" name="frmpt">
    <DIV align="center">
    <CENTER>
    <TABLE width="454" border="0" cellspacing="0" cellpadding="0" height="25">
    <TR>
    <TD></TD>
    </TR>
    </TABLE>
    <TABLE border="0" width="454" height="1" cellpadding="0" cellspacing="1">
    <TR> 
    <TH width="408" height="1" align="left" bgcolor="#000000"><FONT color="#FFFFFF" face="Verdana, Arial, Helvetica, sans-serif" size="2"> 
    Article</FONT></TH>
    <TD width="59" height="1" align="left" bgcolor="#000000"> </TD>
    </TR>
    <%
    	if Not rs.eof Then
    		rs.Move startno
    	End if
    vpage=(startno/10)+1
    if ((recnum/10)-(recnum\10) > 0) Then
    	limit = (recnum\10)+1
    else
    	 	limit = (recnum\10)
    End if
    	mvar=0	
    	nn=0
    Do While Not rs.Eof
    	if nn=0 Then
    		 startno=startno+1
    	mvar=mvar+1
    			nn=1
    %>
    <TR bgcolor="#CCCCCC"> 
    <TD width="59" height="22"><%=Trim(rs.Fields("keterangan"))%></TD>
    <TD> 
    <INPUT type="checkbox" name="chkDel" value="<%=rs("art_id")%>">
    </TD>
    </TR>
    <%
    	Else
    '		nn=1
    			startno=startno+1
    	mvar=mvar+1
    			nn=0
    %>
    <TR> 
    <TD width="408" height="22"><%=Trim(rs.Fields("keterangan"))%></TD>
    <TD width="59" height="22">
    <INPUT type="checkbox" name="chkDel" value="<%=rs("art_id")%>">
    </TD>
    </TR>
    <%
    	End if
    	rs.MoveNext
    	if startno mod 10=0 Then
    	 Exit Do
    End if
    Loop
    %>
    <TR> 
    <TD height="1" style="border-bottom: thin none" valign="middle" width="408"><FONT face="Verdana, Arial, Helvetica, sans-serif" size="1"> 
    <%
    		 if recnum>0 Then
    		 	response.write("Page :")
    		 End if
    		 %>
      
    <%			 
    if startno > 10 Then
    if rs.eof and (rs.recordcount mod 10)<>0 Then
    prevstartno=rs.recordcount-(rs.recordcount mod 10)-10
    else
    prevstartno=startno-20
    End if
    if prevstartno<0 Then
    prevstartno=0
    End if
    else
    prevstartno=0
    End if		 
    		 if startno>10 Then
    response.write "<A href='mnt_art.asp?next=0&mode=next'><FONT face='Verdana' size='-2'>|<</FONT></A> "
    		if (vpage>2) Then
    response.write "<A href='mnt_art.asp?next="& prevstartno &"&mode=next'><FONT face='Verdana' size='-2'><<</FONT></A> "
    			 End if
    		response.write "  "
    	End if 
    		 number_ctr=0
    		 jumpno=0
    		 For i=1 To recnum step 10
    		number_ctr=number_ctr+1
    if vpage=number_ctr Then
    		 response.write "<B>"& Cstr(number_ctr) &"</B> "
    				 a=1
    			 Else
    			if (number_ctr < limit-9) Then
    				 if (number_ctr > vpage) Then
    				a1=a1+1
    					 response.write "<A href='mnt_art.asp?next="& jumpno &"&mode=next'>"& Cstr(number_ctr) &"</A> "
    				 End if
    				 Else
    				 response.write "<A href='mnt_art.asp?next="& jumpno &"&mode=next'>"& Cstr(number_ctr) &"</A> "
    a1 = a1 + 1
    End if
    			 End if
    			 if a1=10 Then
    Exit For
    End if
    jumpno=jumpno+10
    next
    		 if Not rs.eof Then
    		response.write " "
    		if (number_ctr > vpage+1) Then
    response.write " <A href='mnt_art.asp?next="& startno &"&mode=next'>>></A>"
    		End if
    			 response.write " <A href='mnt_art.asp?next="& vendpage &"&mode=next'>>|</A>"
    End if
    'End counting page
    		 %>
    </FONT> </TD>
    <TD height="1" style="border-bottom: thin none" valign="middle" width="59"> 
    <INPUT type="hidden" value="Delete" name="cbDel">
    <INPUT type="button" value="Delete" name="cbDel2" onClick="ActionDel()">
    </TD>
    </TR>
    <TR> 
    <TD colspan="2" height="1" style="border-bottom: thin none" valign="middle"> </TD>
    </TR>
    </TABLE>
    </CENTER></DIV>
    	</FORM>
    <P>  </P>
    </BODY>
    </HTML>

 
 Report Bad Submission
Use this form to notify us if this entry should be deleted (i.e contains no code, is a virus, etc.).
This submission should be removed because:
 
Your Vote!

What do you think of this code(in the Beginner category)?
(The code with your highest vote will win this month's coding contest!)
Excellent  Good  Average  Below Average  Poor See Voting Log
 
Other User Comments
3/6/2004 5:49:09 AM

Sir, your asp coding is good, i'm having problem with checkbox multiple delete in delete.asp. my checkbox successfull sent to delete.asp but the delete.asp page can't looping and delete the records, it's show me error query array. please reply as soon as possible. thanks
(If this comment was disrespectful, please report it.)

 
Add Your Feedback!
Note:Not only will your feedback be posted, but an email will be sent to the code's author from the email account you registered on the site, so you can correspond directly.

NOTICE: The author of this code has been kind enough to share it with you.  If you have a criticism, please state it politely or it will be deleted.

For feedback not related to this particular code, please click here.
 
To post feedback, first please login.


 

Categories | Articles and Tutorials | Advanced Search | Recommended Reading | Upload | Newest Code | Code of the Month | Code of the Day | All Time Hall of Fame | Coding Contest | Search for a job | Post a Job | Ask a Pro Discussion Forum | Live Chat | Feedback | Customize | ASP/ VbScript Home | Site Home | Other Sites | Open Letter from Moderators | About the Site | Feedback | Link to the Site | Awards | Advertising | Privacy

Copyright© 1997-2008 by Exhedra Solutions, Inc. All Rights Reserved.  By using this site you agree to its Terms and Conditions.   Planet Source Code (tm) and the phrase "Dream It. Code It" (tm) are trademarks of Exhedra Solutions, Inc.