Jump to content

Damodar

Members
  • Posts

    9
  • Joined

  • Last visited

About Damodar

  • Birthday 10/12/1954

Previous Fields

  • Languages
    ASP beginner.

Profile Information

  • Location
    Mumbai, India
  • Interests
    Maths, Chemistry, Microbiology, Astronomy, Painting, Sculpting, Trekking and obviously reading.

Damodar's Achievements

Newbie

Newbie (1/7)

0

Reputation

  1. Sir; I changed dropdown to check boxes. I tried below given code. It works but in a strange manner. In my dummy database I have 9 students. Data gets inserted 9 times but in every row of the SQL table I get nine names of the students separated by a comma in first column,nine entries of PRESENT,ABSENT,LATE etc in the second column separated by commas etc. This repeats nine times consuming 9 rows.The code is shown below. Thanks for the valued support. Regards DAMODAR =================================== <% dim i%> <%ses=session("username") if ses="" then Response.redirect"redirect/session_over.asp" end if%> <BODY> <%set rs1= conn1.execute ("select count(*) from rollcall") i = 1 i = i + rs1("") %> <%rs2.open("select count(*)from akah_dorm where Gender = 'GIRL'"),conn2%><hr> <% Dim objExec, counter counter=0 for counter = 0 to rs2(0) response.write("The counter is: "&counter&"<br>")....(This is just for checking.) If rs2(0) <> "" Then strSQL = "" strSQL = strSQL &"INSERT INTO RollCall " strSQL = strSQL &"(Sr_No,Name_of_Student,Status,Occasion,Date) " strSQL = strSQL &"VALUES " strSQL = strSQL &"('"&i&"','"&request.form("stuname")&"','"&request.form("Check")&"','"&request.form("Occasion")&"','"&date()&"')" Set objExec = Conn.Execute(strSQL) End IF next Response.write("Save completed.") Conn.Close() Set objExec = Nothing Set Conn = Nothing %> </BODY>
  2. Sir; As asked by you I am submitting the code. ======================================================================= <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <HTML> <HEAD> <TITLE> New Document </TITLE> <META NAME="Generator" CONTENT="EditPlus"> <META NAME="Author" CONTENT=""> <META NAME="Keywords" CONTENT=""> <META NAME="Description" CONTENT=""> </HEAD> <!--#include file="session/nosession.asp"--> <!--#INCLUDE FILE="connect/dataconnectivity.asp"--> <BODY onload="dynAnimation()" background="images/saraswati.jpg" bgproperties="fixed"> <IMG SRC="images/sis_logo.jpeg" WIDTH="90" HEIGHT="90" BORDER=0 ALT="INTRANET AKAH"><HR><FONT SIZE="3" COLOR="#330033"><B>DORM DATA ENTRY FORM FOR <FONT SIZE="4" COLOR="#FF0000">ROLL CALL AT BREAKFAST, DINNER AND STUDY HOUR.</FONT></B></FONT><br><FONT SIZE="4" COLOR="#660000"><%response.write(FormatDateTime(date(),vblongdate))%></FONT> <CENTER><A HREF="redirect/loginredirect.asp"><FONT SIZE="3" COLOR="red">Log off</FONT></A> <INPUT TYPE="submit" style="background-color: #C0C0C0; color: #800000; letter-spacing: 5pt; border-style: ridge" value="<" onclick = history.go(-1)></CENTER> <%ses=session("username") if ses="" then Response.redirect"redirect/session_over.asp" end if%> <CENTER><FORM METHOD=POST NAME="rollcall"ACTION="" onsubmit="return validateForm()"> <% rs.Open "SELECT Name_of_Student from AKAH_dorm order by Name_of_Student asc", conn %> <TABLE BORDER="0"> <TR bgcolor="#FFFF00"> <%for each x in rs.Fields%> <%response.write("<th>" & x.name & "</th>")%> <%next%> </tr> <%do until rs.EOF%> <tr> <%for each x in rs.Fields%> <td bgcolor="#CCFFFF"><INPUT TYPE="hidden" NAME="stuname" Value="<%Response.Write(Replace((x.value),"""","'"))%>"><%Response.Write(Replace((x.value),"""","'"))%> </td> <td bgcolor="#CCFFFF"> <SELECT NAME="occasion" value=""> <option selected value="Present" >Present</option> <option value="Absent" >Absent</option> <option value="Fasting">Fasting</option> <option value="Sick">Sick</option> <option value="Out of Campus">Out of Campus</option> </SELECT> </td> <%next rs.MoveNext%> </tr> <%loop rs.close conn.close %> <TR> <TD bgcolor="#CCFFFF">Date</TD> <TD bgcolor="#CCFFFF"> <select name="rdate"> <% for i = 1 to 31 if i = day(now) then Response.Write "<option value="&i&" selected>" & i & "</option>" else Response.Write "<option value="&i&">" & i & "</option>" end if next %> </select> <select name="rmonth"> <% for i = 1 to 12 if i = month(now) then Response.Write "<option value="&i&" selected>" & i & "</option>" else Response.Write "<option value="&i&">" & i & "</option>" end if next %> </select> <select name="ryear"> <% for i = 2013to 2016 if i = year(now) then Response.Write "<option value="&i&" selected>" & i & "</option>" else Response.Write "<option value="&i&">" & i & "</option>" end if next %> </select> </TD> </TR> <TR> <TD bgcolor="#CCFFFF">Roll call for :</TD> <TD bgcolor="#CCFFFF"> <SELECT NAME="occasion" value=""> <option selected value="" >Select</option> <option value="Breakfast" >Breakfast</option> <option value="Dinner">Dinner</option> <option value="Evening Study">Evening Study</option> </SELECT> </TD> </TR> </TR> </TABLE><p> <INPUT TYPE="reset"> <INPUT TYPE="submit"> </FORM></CENTER> <script> function validateForm() { var x=document.forms["rollcall"]["occasion"].value; if (x==null || x=="") { alert("Please select occasion of the roll call.Breakfast, Dinner or Study hour. It's the last row."); return false; } } </script> </BODY> </HTML> =============================== Thanks DAMODAR
  3. Dear All; Need your help. I am programming students' roll call in ASP with SQL 2008 R2. There are about 100 students. By default option selected is 'Present' using drop down list. I tried to use radio buttons but only one button remains selected so I am using drop-down list ( How to select multiple radio buttons?). After selecting "Present", "Absent","Late" etc, how do I insert all 100( or whatever number) of rows in the SQL table simultaneously? How should I use "for", "loop" or any other method? Please guide. Regards DAMODAR
  4. Sir; I have developed a website for my Department of Science, which recently is hosted in USA. The website is programmed not to accept any form submissions after 8 pm. Also it gets redirected to "Site is down" page on Saturdays and Sundays. It was OK while the site was over in-house server. Now that its in USA, because the time zone now is different, it does not accept the forms after 8 pm in USA, which is 8 am here in India. Site does not accept forms from 8 am to 12 noon here in India. Also weekend redirect to "Site is down" is of no use due to date being different in USA and in India. Is there any code in ASP or procedure in SQL 2008 R2, whereby I can convert the USA time on the server in USA to Indian Standard Time ( IST ) so that the required functioning of the site happens as per the Indian Time and not as per the time in USA? We are on shared server so the server time can not be changed. Thanks DAMODAR G AGNI
  5. w3schools is one of the best educational website with simple but soothingly attractive design. Functionality is superb too.

×
×
  • Create New...