|
| |
|
|
dschmuecker
Posts: 158 Joined: 10/27/2003 Status: offline
|
Results grouped and in row - 3/3/2007 11:21:18
I'm going to need some help on this one. I setup an asp grade turn-in on our school's server. It works great. Students can upload their projects (jpg, gif, swf) and I have a rubric for evaluation. The students and parents can check work and grade at home. I owe a lot of you forum gurus thanks for helping on certain parts of this. I wiil finally get to the point. When I enter the grades in our IGPro grade program it would be easier to have the grade results grouped and in a row to match the format of the grade program. Here's a link to demo. The top part is how it hopefully can look and the bottom part is the way it looks now. I used raw asp because I thought that it would be necessary to accomplish this task. http://www.kenn.cr.k12.ia.us/deleteme3.html This is the code I have now: <%
Dim connection, recordset
Dim sSQL, sConnString, sports, project, total
sSQL="SELECT * FROM filesquery order by nameInput Asc,order0 asc"
Set connection = Server.CreateObject("ADODB.connection")
Set recordset = Server.CreateObject("ADODB.Recordset")
sConnString="PROVIDER=Microsoft.Jet.OLEDB.4.0;" & _
"Data Source=" & Server.MapPath("../../fpdb/grade.mdb")
Connection.Open sConnString
Recordset.Open sSQL, Connection
response.write "<table width='100%' border='1' cellpadding='10' bgcolor='F2F2F2' align='center'>"
response.write "<tr><td>" & "<table width='100%' border='0' cellpadding='0' cellspacing='0'>"
If Recordset.EOF Then
Response.Write "<tr><td>No records returned.</td></tr>"
Else
Do while Not recordset.eof
Response.Write "<tr><td align='center'>" & "<font face='arial' size='2'>" & recordset("nameInput") & " " & recordset("total") & "</font>" & "</td>"
Response.Write "<td>" & "<font face='arial' size='2'>" & recordset("project") & "</td></tr>"
recordset.MoveNext
loop
response.write "</td></tr></table>" & "</table>"
End if
recordset.Close
Set recordset = Nothing
connection.Close
Set connection = Nothing
%>
Is it possible?
|
|
|
|
lovduv
Posts: 152 Joined: 8/30/2005 Status: offline
|
RE: Results grouped and in row - 3/3/2007 13:26:06
Definitely possiable.... For each <td> that you want to fill you will need something like this: Response.Write(dbfield.value) I find it really helpful to build the page using asp and html and writing the table in asp after you have it looking the way you want and ensuring your code is working for example: <% Dim connection set connection=Server.CreateObject("ADODB.Connection") connection.ConnectionString="Provider=Microsoft.Jet.OLEDB.4.0" connection.open server.mappath("../../fpdb/grade.mdb") Dim Recordset, sSQL set Recordset= Server.CreateObject("ADODB.recordset") Recordset.Open "SELECT * FROM filesquery ORDER BY nameInput ", connection sSQL = whatever additional parameters you need %> <table> <tr> <td style=font-family="arial" size="1em"><%Response.Write(project.value)</td> </tr> </table> Just continue putting your asp in code blocks inside your html. Once it is working the way you want you can move it all into asp with Response.write Hope this helps!
|
|
|
|
dschmuecker
Posts: 158 Joined: 10/27/2003 Status: offline
|
RE: Results grouped and in row - 3/3/2007 18:14:51
I'm not a good enough coder to fill in the gaps in your code. here's my futile attempt. <html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<meta name="GENERATOR" content="Microsoft FrontPage 4.0">
<meta name="ProgId" content="FrontPage.Editor.Document">
<title>Grade Form</title>
</head>
<body bgcolor="#000000">
<!--#include file="menu.asp"-->
<table border="1" width="500" bgcolor="#F2F2F2" align="center">
<tr>
<td align="center" bgcolor="#000000" width="308"><font color="#FFFFFF" face="Arial"><b>Grade
Book</b></font></td>
</tr>
<tr>
<td>
<%
Dim connection, recordset
Dim sSQL, sConnString, sports, project, total
sSQL="SELECT * FROM filesquery order by project Asc"
Set connection = Server.CreateObject("ADODB.connection")
Set recordset = Server.CreateObject("ADODB.Recordset")
sConnString="PROVIDER=Microsoft.Jet.OLEDB.4.0;" & _
"Data Source=" & Server.MapPath("../../fpdb/grade.mdb")
Connection.Open sConnString
Recordset.Open sSQL, Connection
%>
<table>
<tr>
<td style=font-family="arial" size="1em"><%Response.Write(project.value)%></td>
</tr>
</table>
<%
recordset.Close
Set recordset = Nothing
connection.Close
Set connection = Nothing
%>
</td>
</tr>
</table>
</body>
I'm getting this error message which is one of many i could have gotten by hacking the code up as I did. Microsoft VBScript runtime error '800a01a8' Object required: '' /FormsUnrestricted/grade/test.asp, line 53
|
|
|
|
dschmuecker
Posts: 158 Joined: 10/27/2003 Status: offline
|
RE: Results grouped and in row - 3/4/2007 0:02:30
Thanks for following through on this. I have googled but with no luck. I made some modifications in the code. here's what I have. http://www.kenn.cr.k12.ia.us/FormsUnrestricted/grade/test2.asp <html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<meta name="GENERATOR" content="Microsoft FrontPage 4.0">
<meta name="ProgId" content="FrontPage.Editor.Document">
<title>Grade Form</title>
</head>
<body bgcolor="#000000">
<%
Dim connection
set connection=Server.CreateObject("ADODB.Connection")
connection.ConnectionString="Provider=Microsoft.Jet.OLEDB.4.0"
connection.open server.mappath("../../fpdb/grade.mdb")
Dim Recordset
set Recordset = Server.CreateObject("ADODB.recordset")
Recordset.Open "SELECT project,nameinput,total FROM filesquery ORDER BY nameInput Asc,project Asc", connection
%>
<table bgcolor="white" border="1" style="width: 212px">
<tr>
<td>Grade Book</td>
</tr>
<tr>
<%do until Recordset.EOF%>
<%for each project in Recordset.Fields%>
<td><%Response.Write(project.value)%> </td>
<%next
Recordset.MoveNext%>
</tr>
<%loop%>
</table>
<%
recordset.Close
Set recordset = Nothing
connection.Close
Set connection = Nothing
%>
</body>
</html> What I need is to group it by student and run the scores and projects horizontally in adjacent rows.
|
|
|
|
lovduv
Posts: 152 Joined: 8/30/2005 Status: offline
|
RE: Results grouped and in row - 3/4/2007 2:01:17
That link asks for a password? Is the above pulling records?
|
|
|
|
dschmuecker
Posts: 158 Joined: 10/27/2003 Status: offline
|
RE: Results grouped and in row - 3/4/2007 8:55:05
Sorry about that. It was in a restricted folder. This should work http://www.kenn.cr.k12.ia.us/test2.asp Here's the whole picture on this section of the asp grade code. The link below is the beginning file. i'm passing a course (sport) and term (linkinput) and period (heading) variable to the file you are working on. I'm having a little trouble with the Where............criterion on that. Perhaps you are noting on a little over-my-head on this. At least if you get the code figured out I will have another tool. http://www.kenn.cr.k12.ia.us/test1.asp
< Message edited by dschmuecker -- 3/4/2007 9:15:43 >
|
|
|
|
BeTheBall
Posts: 6381 Joined: 6/21/2002 From: West Point Utah USA Status: offline
|
RE: Results grouped and in row - 3/4/2007 10:42:20
I would recommend an array via GetRows and I would use faux rows on the second row of data. The heading row would not be difficult, but the project name and score being on separate rows is problematic due to the way html tables are built. You would be asking the code to build one column of one row followed by a column of the next row and then going back to the first row to insert the next column and so on. Quite a challenge in my opinion. However, you could use two divs inside each column to make the project and score appear to be in different rows. This code is not tested, however, give it a try. You will need to add your own styling to the table and the divs. <%
Dim conntemp, myDSN, myRS, mySQL, arrRecord
Set conntemp=Server.CreateObject("ADODB.Connection")
myDSN ="Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & Server.Mappath("../../fpdb/grade.mdb")
conntemp.open myDSN
mySQL = "SELECT project, nameInput, total FROM filesquery order by nameInput Asc,order0 asc"
Set myRS = Server.CreateObject("ADODB.Recordset")
myRS.Open mySQL, conntemp, 0, 1
arrRecords=myRS.GetRows
myRS.Close
Set myRS = nothing
conntemp.Close
Set conntemp = nothing
%>
<html>
<head>
<style type="text/css">
table{border-collapse:collapse;}
th {border:1px solid #000000;padding:5px}
div{border:1px solid #000000;padding:5px}
</style>
</head>
<body>
<table>
<%
Header = ""
for i = 0 to Ubound(arrRecords,2)
If Header <> arrRecords(0,i) Then
Header=arrRecords(0,i)
Response.write("<tr><td>" & Header & "</td></tr><tr><td><div>" & arrRecords(1,i) & "</div><div>" & arrRecords(2,i) &"</div></td>")
Else
Response.write("<td><div>" & arrRecords(1,i) &"</div><div>"& arrRecords(2,i) & "</div></td>")
End If
Next
%>
</tr>
</table>
</body>
</html>
< Message edited by BeTheBall -- 3/4/2007 18:19:39 >
_____________________________
Duane Some people are like Slinkies . . . Not really good for anything . . . . . But they still bring a smile to your face when you push them down a flight of stairs.
|
|
|
|
lovduv
Posts: 152 Joined: 8/30/2005 Status: offline
|
RE: Results grouped and in row - 3/4/2007 15:42:59
I hadn't thought about the issue with writing to rows (I hate tables), divs would definetly resolve this. Follow BetheBalls advice if that get's the records pulled in the right format I can absolutly help with the styling (divs and such) I am definetly much better at that (lol).
|
|
|
|
dschmuecker
Posts: 158 Joined: 10/27/2003 Status: offline
|
RE: Results grouped and in row - 3/4/2007 19:01:40
It sounds as though it's a pretty complicated procedure to get it horizontal. Vertical will work. http://www.kenn.cr.k12.ia.us/test3.asp If you refer back to my last post, would we be able to incorporate a where criteria into the insert statement? i'm passing a course (sport) and term (linkinput) and period (heading) variable to the file. This should bring up students from one course, term and period so I'm able to register their grades in the grade program. Also, is it big deal to group the results by name? If so, it doesn't matter. This was my orginal goal. http://www.kenn.cr.k12.ia.us/deleteme3.html
|
|
|
|
dschmuecker
Posts: 158 Joined: 10/27/2003 Status: offline
|
RE: Results grouped and in row - 3/4/2007 19:02:43
Thanks. You helped me out before on some impossible code problem. I appreciate it.
|
|
|
|
lovduv
Posts: 152 Joined: 8/30/2005 Status: offline
|
RE: Results grouped and in row - 3/4/2007 23:23:49
I think it's this..... linkInput would be the term in your url, 2nd for example. TermField is your field in the DB that holds the term value 2nd, 1st, 4th whatever. Just make sure that what's being passed in your url matches whats in the DB. Add this variable Dim Sql Define the Variable Sql = Request.QueryString("linkInput") Add the Variable to your WHERE clause Recordset.Open "SELECT project,nameinput,total FROM filesquery WHERE TermField = "Sql" ORDER BY nameInput Asc,project Asc", connection
|
|
|
|
dschmuecker
Posts: 158 Joined: 10/27/2003 Status: offline
|
RE: Results grouped and in row - 3/4/2007 23:49:41
I get this error message: http://www.kenn.cr.k12.ia.us/test2.asp?sport=Computer%20Graphics%202&linkInput=Winter&heading=3rd <html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<meta name="GENERATOR" content="Microsoft FrontPage 4.0">
<meta name="ProgId" content="FrontPage.Editor.Document">
<title>Grade Form</title>
</head>
<body bgcolor="#000000">
<%
Sql = Request.QueryString("sport")
Sql = Request.QueryString("linkInput")
Sql = Request.QueryString("heading")
%>
<%
Dim connection
set connection=Server.CreateObject("ADODB.Connection")
connection.ConnectionString="Provider=Microsoft.Jet.OLEDB.4.0"
connection.open server.mappath("fpdb/grade.mdb")
Dim Recordset
set Recordset = Server.CreateObject("ADODB.recordset")
Recordset.Open "SELECT project,nameinput,total FROM filesquery WHERE sport = "Sql" and linkInput = "Sql" and heading = "Sql" ORDER BY nameInput Asc,project Asc", connection
%>
<table bgcolor="white" border="1" style="width: 212px">
<tr>
<td>Project</td>
<td>Name</td>
<td>Grade</td>
</tr>
<tr>
<%do until Recordset.EOF%>
<%for each project in Recordset.Fields%>
<td><%Response.Write(project.value)%> </td>
<%next
Recordset.MoveNext%>
</tr>
<%loop%>
</table>
<%
recordset.Close
Set recordset = Nothing
connection.Close
Set connection = Nothing
%>
</body>
</html>
|
|
|
|
lovduv
Posts: 152 Joined: 8/30/2005 Status: offline
|
RE: Results grouped and in row - 3/5/2007 0:12:01
You will need diffrent variable names i.e Sql Sql1 Sql2 Try <head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<meta name="GENERATOR" content="Microsoft FrontPage 4.0">
<meta name="ProgId" content="FrontPage.Editor.Document">
<title>Grade Form</title>
</head>
<body bgcolor="#000000">
<%
Dim Sql, Sql1, Sql2
Sql = Request.QueryString("sport")
Sql1 = Request.QueryString("linkInput")
Sql2 = Request.QueryString("heading")
Dim connection
set connection=Server.CreateObject("ADODB.Connection")
connection.ConnectionString="Provider=Microsoft.Jet.OLEDB.4.0"
connection.open server.mappath("fpdb/grade.mdb")
Dim Recordset
set Recordset = Server.CreateObject("ADODB.recordset")
Recordset.Open "SELECT project,nameinput,total FROM filesquery WHERE sport = "Sql" and linkInput = "Sql1" and heading = "Sql2" ORDER BY nameInput Asc,project Asc", connection
%>
<table bgcolor="white" border="1" style="width: 212px">
<tr>
<td>Project</td>
<td>Name</td>
<td>Grade</td>
</tr>
<tr>
<%do until Recordset.EOF%>
<%for each project in Recordset.Fields%>
<td><%Response.Write(project.value)%> </td>
<%next
Recordset.MoveNext%>
</tr>
<%loop%>
</table>
<%
recordset.Close
Set recordset = Nothing
connection.Close
Set connection = Nothing
%>
</body>
</html>
Just to be sure...these are field names in your DB right? sport linkInput heading
< Message edited by lovduv -- 3/5/2007 0:20:06 >
|
|
|
|
BeTheBall
Posts: 6381 Joined: 6/21/2002 From: West Point Utah USA Status: offline
|
RE: Results grouped and in row - 3/5/2007 20:31:08
You have to escape quotes when inserting variables. The following will get rid of the errors. Recordset.Open "SELECT project,nameinput,total FROM filesquery WHERE sport = " & Sql & " and linkInput = " & Sql1 & " and heading = " & Sql2 & " ORDER BY nameInput Asc, project Asc", connection
_____________________________
Duane Some people are like Slinkies . . . Not really good for anything . . . . . But they still bring a smile to your face when you push them down a flight of stairs.
|
|
|
|
lovduv
Posts: 152 Joined: 8/30/2005 Status: offline
|
RE: Results grouped and in row - 3/6/2007 9:45:31
Thank goodness for BetheBall I am great at pointing to the right direction, and then making the wrong turn!
|
|
|
|
dschmuecker
Posts: 158 Joined: 10/27/2003 Status: offline
|
RE: Results grouped and in row - 3/7/2007 0:37:28
You guys do a great job and I've had a lot of help on many issues. I feel bad telling you the code doesn't work in this case. I removed the where criteria statement and it worked so it's in the where statement. Here's the link to the preceding page and the code. If you have time. maybe you can figure this out. thanks much. http://www.kenn.cr.k12.ia.us/test1.asp The field name are correct. I'm probably just missing something obvious. <html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<meta name="GENERATOR" content="Microsoft FrontPage 4.0">
<meta name="ProgId" content="FrontPage.Editor.Document">
<title>Grade Form</title>
</head>
<body bgcolor="#ffffff">
<%
Dim Sql, Sql1, Sql2
Sql = Request.QueryString("sport")
Sql1 = Request.QueryString("linkInput")
Sql2 = Request.QueryString("heading")
Dim connection
set connection=Server.CreateObject("ADODB.Connection")
connection.ConnectionString="Provider=Microsoft.Jet.OLEDB.4.0"
connection.open server.mappath("fpdb/grade.mdb")
Dim Recordset
set Recordset = Server.CreateObject("ADODB.recordset")
Recordset.Open "SELECT project,nameinput,total FROM filesquery WHERE sport = " & Sql & " and linkInput = " & Sql1 & " and heading = " & Sql2 & " ORDER BY nameInput Asc, project Asc", connection
%>
<table bgcolor="white" border="1" style="width: 212px">
<tr>
<td>Project</td>
<td>Name</td>
<td>Grade</td>
</tr>
<tr>
<%do until Recordset.EOF%>
<%for each project in Recordset.Fields%>
<td><%Response.Write(project.value)%> </td>
<%next
Recordset.MoveNext%>
</tr>
<%loop%>
</table>
<%
recordset.Close
Set recordset = Nothing
connection.Close
Set connection = Nothing
%>
</body>
</html>
|
|
|
|
lovduv
Posts: 152 Joined: 8/30/2005 Status: offline
|
RE: Results grouped and in row - 3/7/2007 1:03:10
Not really sure it looks right and in the error it is pulling the querystring ..... Try just this as the WHERE clause WHERE sport = " & Sql & " ORDER BY nameInput Asc, project Asc", connection Let's see if the error is further in the clause.... If it's obvious, I am sure BetheBall will be along soon!
|
|
New Messages |
No New Messages |
Hot Topic w/ New Messages |
Hot Topic w/o New Messages |
Locked w/ New Messages |
Locked w/o New Messages |
|
Post New Thread
Reply to Message
Post New Poll
Submit Vote
Delete My Own Post
Delete My Own Thread
Rate Posts
|
|
|