Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > Visual Basic > BOOK: VBScript Programmer's Reference, 1st, 2nd, and 3rd editions
Password Reminder
Register
Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
BOOK: VBScript Programmer's Reference, 1st, 2nd, and 3rd editions
This is the forum to discuss the Wrox book VBScript Programmer's Reference, 3rd Edition by Adrian Kingsley-Hughes, Kathie Kingsley-Hughes, Daniel Read; ISBN: 9780470168080
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: VBScript Programmer's Reference, 1st, 2nd, and 3rd editions section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developersí questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Closed Thread
 
Thread Tools Display Modes
  #1 (permalink)  
Old April 2nd, 2004, 04:26 AM
Registered User
 
Join Date: Apr 2004
Location: Tawang, Arunachal Pradesh, India.
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default Check boxes to add data in table using ASP

I have a page in which i fetch data from atable having 12 fields which on check with checked with check box should select the corressponding fields of that row and the add all the fields of that row in a new table with the help of check box.

The first page which displays the fields of the table wid a check box is given below.

<%@ Language=VBScript %>


<%
Response.write "The Current Time is" & date()
%>
<html>
<head>

<title>Income Certificate</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<meta name="description" content="Fireworks Splice HTML">
<style type="text/css">
<!--
.t1 { font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 8pt; color: #330066}
.t2 { font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 9pt; font-weight: bolder; font-variant: normal; color: #FFFFFF; text-decoration: none}
a { font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 9pt; font-weight: normal; color: #330066; text-decoration: none}
A:hover {text-decoration: underline; color: #990000;}
.text { font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 9pt; font-weight: normal; color: #000458; text-decoration: none; line-height: 15pt}
.navigation { font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 10pt; font-weight: bold; color: #FFFFFF; text-decoration: none}
.h1 { font-family: Arial, Helvetica, sans-serif; font-size: 11pt; font-weight: bold; color: #990000}
.h2 { font-family: Arial, Helvetica, sans-serif; font-size: 13pt; color: #990000; font-weight: bold; text-decoration: none}
.txt2 { font-family: "Times New Roman", Times, serif; font-size: 8pt; font-weight: normal; color: #000066; text-decoration: none}
.h1Copy { font-family: Arial, Helvetica, sans-serif; font-size: 11pt; font-weight: bold; color: #000000}
.heading { font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 12pt; font-weight: bold; color: #FFFFFF; text-decoration: none}
.heading2 { font-family: Arial, Helvetica, sans-serif; font-size: 11pt; font-weight: bolder; color: #990000; text-decoration: none }
-->
</style>
<SCRIPT LANGUAGE="JavaScript" TYPE="text/javascript">
function CheckAll(chk)
{
for (var i=0;i < document.f1.elements.length;i++)
    {
        var e = document.f1.elements[i];
        if (e.type == "checkbox")
        {
            e.checked = chk.checked;
        }
    }
}
</script>
<script type="text/javascript" language="JavaScript1.2" src="stm31.js"></script>
</head>
<body bgproperties="fixed" bgcolor="#FFCC99" onLoad="checkForm();">

<table border="0" width="678" height="273">
<tr>
      <td width="689" height="65">
        <p align="center"><img border="0" src="Topp.gif" width="100%" height="63">
      </td>
    </tr>
        <tr>
            <td valign="top" width="689" height="21">
            <tr>
                <td align="center" height="21" width="689">

<script type="text/javascript" language="JavaScript1.2">
<!--
beginSTM("ivvnair","static","0","0","none","false" ,"true","310","50","0","0","","blank.gif");
beginSTMB("auto","0","0","horizontally","arrow_r.g if","0","0","1","4","transparent","","tiled","#fff fff","0","none","31","Normal","50","0","0","0","0" ,"0","0","1","#ffcc00","false","#ffffff","#ffffff" ,"#ffffff","simple");
appendSTMI("false","Home&nbsp;","left","middle","" ,"","-1","-1","0","normal","transparent","transparent","","1" ,"-1","-1","blank.gif","blank.gif","-1","-1","0","","default.asp","_self","Arial","8pt","#00 0000","bold","normal","none","Arial","8pt","#00000 0","bold","normal","none","1","solid","#cccccc","# cccccc","#9690a8","#9690a8","#cccccc","#cccccc","# 9690a8","#9690a8","default.htm","xp3.gif","xp4.gif ","tiled","tiled");
appendSTMI("false","Applications Approved","left","middle","","","-1","-1","0","normal","transparent","transparent","","1" ,"-1","-1","blank.gif","blank.gif","-1","-1","0","","approvedapplications.asp","_self","Aria l","8pt","#000000","bold","normal","none","Arial", "8pt","#000000","bold","normal","none","1","solid" ,"#cccccc","#cccccc","#999999","#999999","#cccccc" ,"#cccccc","#999999","#999999","cicoperator.asp"," xp3.gif","xp4.gif","tiled","tiled");
appendSTMI("false","New Applications","left","middle","","","-1","-1","0","normal","transparent","transparent","","1" ,"-1","-1","blank.gif","blank.gif","-1","-1","0","","newapplications.asp","_self","Arial","8 pt","#000000","bold","normal","none","Arial","8pt" ,"#000000","bold","normal","none","1","solid","#cc cccc","#cccccc","#999999","#999999","#cccccc","#cc cccc","#999999","#999999","cicoperator.asp","xp3.g if","xp4.gif","tiled","tiled");
appendSTMI("false","Applications to be Approved","left","middle","","","-1","-1","0","normal","transparent","transparent","","1" ,"-1","-1","blank.gif","blank.gif","-1","-1","0","","applicationstobeapproved.asp","_self"," Arial","8pt","#000000","bold","normal","none","Ari al","8pt","#000000","bold","normal","none","1","so lid","#cccccc","#cccccc","#999999","#999999","#ccc ccc","#cccccc","#999999","#999999","cicoperator.as p","xp3.gif","xp4.gif","tiled","tiled");
appendSTMI("false","Applications Rejected","left","middle","","","-1","-1","0","normal","transparent","transparent","","1" ,"-1","-1","blank.gif","blank.gif","-1","-1","0","","applicationsrejected.asp","_self","Aria l","8pt","#000000","bold","normal","none","Arial", "8pt","#000000","bold","normal","none","1","solid" ,"#cccccc","#cccccc","#999999","#999999","#cccccc" ,"#cccccc","#999999","#999999","cicoperator.asp"," xp3.gif","xp4.gif","tiled","tiled");
appendSTMI("false","Remove&nbsp;Applications","lef t","middle","","","-1","-1","0","normal","transparent","transparent","","1" ,"-1","-1","blank.gif","blank.gif","-1","-1","0","","removeapplication.asp","_self","Arial", "8pt","#000000","bold","normal","none","Arial","8p t","#000000","bold","normal","none","1","solid","# cccccc","#cccccc","#999999","#999999","#cccccc","# cccccc","#999999","#999999","cicoperator.asp","xp3 .gif","xp4.gif","tiled","tiled");
appendSTMI("false","Change&nbsp;Password","left"," middle","","","-1","-1","0","normal","transparent","transparent","","1" ,"-1","-1","blank.gif","blank.gif","-1","-1","0","","Changepasswd.asp","_self","Arial","8pt" ,"#000000","bold","normal","none","Arial","8pt","# 000000","bold","normal","none","1","solid","#ccccc c","#cccccc","#999999","#999999","#cccccc","#ccccc c","#999999","#999999","cicoperator.asp","xp3.gif" ,"xp4.gif","tiled","tiled");
appendSTMI("false","Signout","left","middle","","" ,"-1","-1","0","normal","transparent","transparent","","1" ,"-1","-1","blank.gif","blank.gif","-1","-1","0","","signout.asp","_self","Arial","8pt","#00 0000","bold","normal","none","Arial","8pt","#00000 0","bold","normal","none","1","solid","#cccccc","# cccccc","#999999","#999999","#cccccc","#cccccc","# 999999","#999999","cicoperator.asp","xp3.gif","xp4 .gif","tiled","tiled");
endSTMB();
endSTM();
//-->
</script>

 </tr>
 <tr><td width="100%" height="18"><B><CENTER>New Applications to be Approved</CENTER></B></tr>
 <tr><td width="100%" height="12" bordercolor="#66CC99" bgcolor="#FFCC99">
    <p align="center">
    <INPUT TYPE="checkbox" NAME="selectall1" VALUE="Select All" OnClick="CheckAll(this)">
    <B>Select all Applications</B></tr>
     <tr><td align="center" height="87" width="689">
 <%
dim rst

set rst=server.CreateObject("ADODB.Recordset")

rst.Open "select * from Newlistapply order by Date_of_Appln", cnn, adOpenDynamic, adLockReadOnly, adCmdText

if rst.BOF and rst.EOF then
    Response.Write("<B><CENTER>There is no record in the table</CENTER></B>")
else
%><FORM METHOD="POST" name="f1" ACTION="approve.asp">
    <table align="center" border="0" bordercolor="#0000FF" bgcolor="#FFCC99" width="687" height="41">
    <tr>
    <th bgcolor="#66CC99" width="85" align="justify" height="8">Select
          Application
          <th bgcolor="#66CC99" width="86" align="justify" height="8">Applicationid</th>
        <th bgcolor="#66CC99" width="63" align="justify" height="8">Name
          of Applicant
        <th bgcolor="#66CC99" width="57" align="justify" height="8"> Father's Name
        <th bgcolor="#66CC99" width="56" align="justify" height="8">
         <p align="center">
         Address
        <th bgcolor="#66CC99" width="51" align="justify" height="8">Income in
          Rupees
        <th bgcolor="#66CC99" width="73" align="justify" height="8">Block
        <th bgcolor="#66CC99" width="63" align="justify" height="8">District
        <th bgcolor="#66CC99" width="47" align="justify" height="8">BPL Survey Year
        <th bgcolor="#66CC99" width="60" align="justify" height="8">BPL House NO.
        <th bgcolor="#66CC99" width="60" align="justify" height="8">Name of BDO
        <th bgcolor="#66CC99" width="60" align="justify" height="8">Status

    </tr>
<%
    rst.MoveFirst
    do until rst.EOF
%>
        <tr><td align="justify" width="85" bgcolor="#C0C0C0">
            <p align="center"><input type="checkbox" name ="chk" value="<% response.write rst("Application_Id")%>" size="10" type="text">

        <td width="86" align="justify" height="25" bgcolor="#C0C0C0"><input type="Hidden" name="Applicationid"><% response.write rst("Application_Id")%></td>
            <td width="63" height="25" align="justify" bgcolor="#C0C0C0"><input type="Hidden" name="Name"><% response.write rst("Name")%></td>
            <td width="57" align="justify" height="25" bgcolor="#C0C0C0"><input type="Hidden" name="Fname"><% response.write rst("Fname")%></td>
            <td width="56" height="25" align="justify" bgcolor="#C0C0C0"><input type="Hidden" name="Address"><% response.write rst("Address")%></td>
            <td width="51" align="justify" height="25" bgcolor="#C0C0C0"><input type="Hidden" name="Income"><% response.write rst("Income")%></td>
            <td width="73" height="25" align="justify" bgcolor="#C0C0C0"><input type="Hidden" name="Block"><% response.write rst("Block")%></td>
            <td width="63" height="25" align="justify" bgcolor="#C0C0C0"><input type="Hidden" name="District"><% response.write rst("District")%></td>
            <td width="47" height="25" align="justify" bgcolor="#C0C0C0"><input type="Hidden" name="BPLSurveyyear"><% response.write rst("BPLSurveyyear")%></td>
            <td width="60" height="25" align="justify" bgcolor="#C0C0C0"><input type="Hidden" name="BPLHNO"><% response.write rst("BPLHNO")%></td>
            <td width="3" height="25" align="justify" bgcolor="#C0C0C0"><INPUT TYPE="hidden" NAME="BDOName" size="10"><% response.write rst("BDOName")%></td>
            <td width="3" height="25" align="justify" bgcolor="#C0C0C0"><INPUT TYPE="Hidden" NAME="Status" value='Approved'>Approved</td>

        </tr>
<%
          rst.MoveNext
    loop
%>
    </table>
<%
end if
%>
 </td></tr>
 <tr >
                      <td width="689" height="21"><span class="t1"><b>* Please note that this facility
                        is restricted only to the BDO's and CIC
                        Operator's only</b></span>. </td>
 </tr>

</table><CENTER>
<input type="Submit" value="Approve"
      name="Submit" style="BACKGROUND: #ffbc79; COLOR: Blue; FONT-WEIGHT: bold">
All Checked User(s)&nbsp;&nbsp;&nbsp;<input type="Reset" value="Reset" name="Submit" style="BACKGROUND: #ffbc79; COLOR: Blue; FONT-WEIGHT: bold">

</CENTER>
</FORM>
<div align="right"><a href="javascript:history.back();">Back</a>
<a href="default.asp">Home</a><div style="width: 676; height: 1">
               </div>

               </div>
<p align="center"><img border="0" src="niclogo.gif" width="62" height="21"><b><br>
</b><span class="t1">Disclaimer::
Designed and Developed by<br>
National Informatics Center, Tawang<br>
Arunachal Pradesh -790104<br>
Email :: tawang@hub.nic.in</span></p>
<p align="right"><a href="javascript:history.back()">Back</a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a href="default.asp" style="COLOR: blue" target=_parent>Home</a></p>
</body>


From this page the fields should be added using this code. but is giving an error showing the file is already in use.
This is the code

<%@ Language=VBScript%>
<%option Explicit%>


<HTML>
<body bgproperties="fixed" bgcolor="#FFCC99">
<%
Dim strapproveList, strSQL, rs, Msg, Cnt, I, strArr

strapproveList = Request.Form("chk")
strArr = split(strapproveList, ",")
'strapproveList = Replace(strapproveList, ",",",")
'Response.write(strapproveList)
Dim iloop
For iloop = LBound(strArr) to Ubound(strArr)
Response.write strArr(iloop) & "<BR>"
 if strapproveList = strArr(iloop) then
'strapproveList = Replace(strapproveList, ", ", "'+Request(Application_Id)+,+Request(Name)+,+Reque st(Fname)+,+Request(Block)+,+Request(District)+,+R equest(Income)+,+Request(BPLSurveyyear)+,+Request( BPLHNO)+,+Request(BDOName)+,+Request(Status)+")
'RS.Open "Select * From Users Where Application_Id='"+Request.Form("chk")+"'", cnn, adCmdText
'end if
'next
'elseIf strapproveList = "" then
    Response.Write("<TABLE width='100%'><TR><TD bgcolor='#FF0033'><CENTER>You have Not Selected Any Application for Approval</CENTER><TD><TR><TD bgcolor='#339966'><CENTER><a href='javascript:history.back();'>Back</a><a href='default.asp'>Home</a></CENTER></TD></TABLE>")
Else
    strSQL = cnn.Execute("Insert into approvedapplications (strArr) values ('"+Request("Application_Id")+"', '"+Request("Name")+"', '"+Request("Fname")+"', '"+Request("Address")+"', '"+Request("Block")+"', '"+Request("District")+"','"+Request("Income")+"', '"+Request("BPLSurveyyear")+"','"+Request("BPLHNO" )+"','"+Request("BDOName")+"','"+Request("Status") +"')")
    'strSQL = "INSERT INTO approvedapplications (Application_Id, Name, Fname, Address, Block, District, Income,BPLSurveyyear,BPLHNO,BDOName,Status) VALUES ('"+Request("Application_Id")+"', '"+Request("Name")+"', '"+Request("Fname")+"', '"+Request("Address")+"', '"+Request("Block")+"', '"+Request("District")+"','"+Request("Income")+"', '"+Request("BPLSurveyyear")+"','"+Request("BPLHNO" )+"','"+Request("BDOName")+"','"+Request("Status") +"')"
    'cnn.Execute(strSQL)
    'cnn.update(strSQL)


    cnn.Close
    Set cnn = Nothing

    Msg = "<CENTER><B>The Application(s) is/are Approved.</B></CENTER>"
'End elseIf
end if
next
Response.Write(Msg)
Server.transfer("applicationstobeapproved.asp")

%>
<p align="left"><a href='javascript:history.back();'>Back</a><a href='default.asp'>Home</a><TD></CENTER></TABLE></p>
</BODY>
</HTML>

Give a solution of it.
__________________
PKThungon
Closed Thread


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Check boxes to appear with Table Names hewstone999 Access VBA 1 March 13th, 2008 10:51 AM
error when trying to add data to table Vince_421 Access VBA 17 May 6th, 2007 01:29 PM
Check Boxes Allan320 Access VBA 3 June 2nd, 2006 05:45 AM
Add Push button or Check Box in outlook add-ins capdevs VS.NET 2002/2003 0 January 7th, 2006 07:51 AM
add same data in diff table / search yylee Access VBA 8 April 13th, 2004 02:39 AM



All times are GMT -4. The time now is 10:59 PM.


Powered by vBulletin® Version 3.7.0
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.