Jump to content


  • Posts

  • 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 (1/7)



  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. Dear Duotone Fox; Thanks a lot. It was really silly on my part not to realise the mistake. It is nice of you to point it out. It solved my problem.THANK YOU.
  6. Sir; I am developing student muster roll for my school.See below given part of the files for the problem that I am facing. 1) grade_details.asp : ( Form with the values ) <%Do while not Rs.EOF if grade = Rs("student_homegrade") then Response.Write "<OPTION NAME = stuid VALUE = '" & RS("student_id") & "' SELECTED>" 'stuid is not passed to enter_stu_recs.asp. I am making mistake somewhere. Please guide. Response.Write replace(Rs("student_name"),"""","'") & "</Option>" Rs.MoveNext else Response.Write "<OPTION NAME = stuid VALUE = '" & RS("student_id") & "'>" Response.Write replace(Rs("student_name"),"""","'") & "</Option>" Rs.MoveNext end ifloop%> 2) enter_stu_recs.asp ( The page where the values are to be transferred ) <% Dim objExec,dayab,monthab,yearab,stu_id,abdayab=request.form("rdate")monthab=request.form("rmonth")yearab=request.form("ryear")stu_id=request.form("stuid")ab=request.form("absent")%> <hr><%response.write dayab %><hr><%response.write monthab%> <hr><%response.write yearab%> <hr><%response.write stu_id%> ?<hr><%response.write session("username")%><hr><%response.write ab%><hr>---------------------------------------------------- Output as shown below: 2392011(THIS CALUE IS NOT SHOWN)?12345ABSENT Iam facing a problem. Values from, form in grade_details.asp file show up in enter_stu_recs file except stuid. ( Student's id is not passed to the enter_stu_recs from grade_details.) Will somebody help me out with this problem? Thanks in advance. Squareonthehypotenuse.
  7. w3schools is one of the best educational website with simple but soothingly attractive design. Functionality is superb too.

  8. Thanks a lot. I will surely let you know once I use your code. Thanks once again.
  9. Thanks a lot. I will surely let you know once I use your code. Thanks once again.
  10. Dear All;I am designing student roll muster for my school using ASP. I know how to insert one record at a time in SQL table but this would not be convenient. What I need is like this....If there are X students in a given grade then this data should be fetched from the student master table and shown in a form with X radio buttons against names of each student. Teacher then will select "Absent" against the students who are absent on that day. After submitting this form ALL the rows with "Present" and "Absent" status should enter simultaneously in a table called "Student_roll_details".I know how to fetch this data from the table. select count(*) will give me the total number to loop. I do not know how to enter multiple rows at a time. I do have a sample code downloaded from internet and modified for my table, but time being I am traveling and can not test the code till mid July. The code is given below. Do you think this is a right code?==============================================================<% Option Explicit %> <html> <head> <title></title> </head> <body> <% Dim Conn,strSQL,objExec,i Set Conn = Server.Createobject("ADODB.Connection") Conn.Open "Driver={SQL Server};Server=localhost;Database=mydatabase;UID=sa;PWD=;" For i = 1 To Request.Form("studentCount") If Trim(Request.Form("studentID" & i)) <> "" Then strSQL = "" strSQL = strSQL &"INSERT INTO student_roll_details" strSQL = strSQL &"(StudentID,Name,Grade,Date,Status,Teacher) " strSQL = strSQL &"VALUES " strSQL = strSQL &"('"&Request.Form("studentID" & i)&"','"&Request.Form("studentName" & i)&"', '"&Request.Form("studentGrade" & i)&"' " strSQL = strSQL &",'"&Request.Form("TodayDate" & i)&"','"&Request.Form("stu_absent_present" & i)&"', '"&Request.Form("teacherName" & i)&"') " Set objExec = Conn.Execute(strSQL) End IF Next Response.write("Save completed. Click <a href='student_multiple_insert3.asp'>here</a> to view.") Conn.Close() Set objExec = Nothing Set Conn = Nothing %> </body> </html> =====================This is my first post. Please be kind enough to educate me.
  • Create New...