-
One to Many - Add of the Child Record
I have a studentprogress table with a foreign key to student table.
I have set up so that students can logon using a userid/password in the student table. I then show them all their lesson history (for example,
which lessons they finished, the date, their grade, and comments).
Now, I want them to be able to securely add a new record, but only
with their student-id filled in.
Ideas:
1) Could I use a hidden form field?
2) Can I stuff the field from a Session variable?
Problems:
1) MagicCell applies to the GRID but not the ADD form.
My hosting services has ASPDB/Pro, so please suggest a solution that
will work within this framework.
Some of the code I'm using looks like this, where the student id is in a Session variable.
Set MyDb2=Server.CreateObject("ASPdb.Pro"
MyDB2.dbDSN = "DSN=nwalterssql;UID=xxxxxx;PWD=xxxxx;"
MyDB2.dbDBType = "SQL"
MyDB2.dbMode = "grid"
Session("mySql" = "Select * from studprogress, students where studprog_studid = student_id and student_userid ='" & Session("StudentUserId" & "'"
Response.Write "Value of Database SQL=[" & Session("mySql" & "] <br>"
MyDB2.dbSQL = Session("mySql"
MyDB2.dbNavigationItem = "top,prev,next,bottom,add,update,edit"
MyDB2.dbEditParams = "TableName=studprogress,BookMarkFlds=studprog_ id"
MyDB2.dbEditFlds = "studprog_studid,studprog_lessons,studprog_sel fgrade,studprog_testgrade,studprog_hours,studprog_ comment"
MyDB2.dbGridDisplayFlds = "studprog_date,studprog_lessons,studprog_selfg rade,studprog_testgrade,studprog_hours,studprog_co mment" 'Display only these fields
MyDB2.dbNameMap = "studprog_date,Date,;" _
& "studprog_lessons,Lessons,;" _
& "studprog_studid,Student ID,;" _
& "studprog_selfgrade,SelfGrade,;" _
& "studprog_testgrade,TestGrade,;" _
& "studprog_hours,StudyHours,;" _
& "studprog_comment,Comment,;"
'format field as currency and start running total
ID = Session("ID"
'MyDB2.dbMagicCell = "studprog_studid,,ID"
MyDB2.ASPdbPro
%>
You can logon as "demo" at http://wisdomcalls.com/students/logon.asp
Thanks,
Neal Walters
http://walters.km.net
-
One to Many - Add of the Child Record (reply)
Neal,
To really do it right you would need to use: dbEditAddROFlds
This property is available in ASP-db Enterprise only.
See Programming Example 15 at http://www.aspdb.com/V2
Yes, you could stuff the field from a Session variable.
Mark.
------------
Neal Walters at 4/26/00 3:45:52 PM
I have a studentprogress table with a foreign key to student table.
I have set up so that students can logon using a userid/password in the student table. I then show them all their lesson history (for example,
which lessons they finished, the date, their grade, and comments).
Now, I want them to be able to securely add a new record, but only
with their student-id filled in.
Ideas:
1) Could I use a hidden form field?
2) Can I stuff the field from a Session variable?
Problems:
1) MagicCell applies to the GRID but not the ADD form.
My hosting services has ASPDB/Pro, so please suggest a solution that
will work within this framework.
Some of the code I'm using looks like this, where the student id is in a Session variable.
Set MyDb2=Server.CreateObject("ASPdb.Pro"
MyDB2.dbDSN = "DSN=nwalterssql;UID=xxxxxx;PWD=xxxxx;"
MyDB2.dbDBType = "SQL"
MyDB2.dbMode = "grid"
Session("mySql" = "Select * from studprogress, students where studprog_studid = student_id and student_userid ='" & Session("StudentUserId" & "'"
Response.Write "Value of Database SQL=[" & Session("mySql" & "] <br>"
MyDB2.dbSQL = Session("mySql"
MyDB2.dbNavigationItem = "top,prev,next,bottom,add,update,edit"
MyDB2.dbEditParams = "TableName=studprogress,BookMarkFlds=studprog_ id"
MyDB2.dbEditFlds = "studprog_studid,studprog_lessons,studprog_sel fgrade,studprog_testgrade,studprog_hours,studprog_ comment"
MyDB2.dbGridDisplayFlds = "studprog_date,studprog_lessons,studprog_selfg rade,studprog_testgrade,studprog_hours,studprog_co mment" 'Display only these fields
MyDB2.dbNameMap = "studprog_date,Date,;" _
& "studprog_lessons,Lessons,;" _
& "studprog_studid,Student ID,;" _
& "studprog_selfgrade,SelfGrade,;" _
& "studprog_testgrade,TestGrade,;" _
& "studprog_hours,StudyHours,;" _
& "studprog_comment,Comment,;"
'format field as currency and start running total
ID = Session("ID"
'MyDB2.dbMagicCell = "studprog_studid,,ID"
MyDB2.ASPdbPro
%>
You can logon as "demo" at http://wisdomcalls.com/students/logon.asp
Thanks,
Neal Walters
http://walters.km.net
-
One to Many - Add of the Child Record (reply)
Neal,
There is a "sneaky" way to specify a predefined read-only field during an Add using ASP-db Pro. See Programming Example 122 at:
http://www.aspdb.com/apps
I hope that helps.
Mark.
------------
Mark at 4/26/00 3:56:18 PM
Neal,
To really do it right you would need to use: dbEditAddROFlds
This property is available in ASP-db Enterprise only.
See Programming Example 15 at http://www.aspdb.com/V2
Yes, you could stuff the field from a Session variable.
Mark.
------------
Neal Walters at 4/26/00 3:45:52 PM
I have a studentprogress table with a foreign key to student table.
I have set up so that students can logon using a userid/password in the student table. I then show them all their lesson history (for example,
which lessons they finished, the date, their grade, and comments).
Now, I want them to be able to securely add a new record, but only
with their student-id filled in.
Ideas:
1) Could I use a hidden form field?
2) Can I stuff the field from a Session variable?
Problems:
1) MagicCell applies to the GRID but not the ADD form.
My hosting services has ASPDB/Pro, so please suggest a solution that
will work within this framework.
Some of the code I'm using looks like this, where the student id is in a Session variable.
Set MyDb2=Server.CreateObject("ASPdb.Pro"
MyDB2.dbDSN = "DSN=nwalterssql;UID=xxxxxx;PWD=xxxxx;"
MyDB2.dbDBType = "SQL"
MyDB2.dbMode = "grid"
Session("mySql" = "Select * from studprogress, students where studprog_studid = student_id and student_userid ='" & Session("StudentUserId" & "'"
Response.Write "Value of Database SQL=[" & Session("mySql" & "] <br>"
MyDB2.dbSQL = Session("mySql"
MyDB2.dbNavigationItem = "top,prev,next,bottom,add,update,edit"
MyDB2.dbEditParams = "TableName=studprogress,BookMarkFlds=studprog_ id"
MyDB2.dbEditFlds = "studprog_studid,studprog_lessons,studprog_sel fgrade,studprog_testgrade,studprog_hours,studprog_ comment"
MyDB2.dbGridDisplayFlds = "studprog_date,studprog_lessons,studprog_selfg rade,studprog_testgrade,studprog_hours,studprog_co mment" 'Display only these fields
MyDB2.dbNameMap = "studprog_date,Date,;" _
& "studprog_lessons,Lessons,;" _
& "studprog_studid,Student ID,;" _
& "studprog_selfgrade,SelfGrade,;" _
& "studprog_testgrade,TestGrade,;" _
& "studprog_hours,StudyHours,;" _
& "studprog_comment,Comment,;"
'format field as currency and start running total
ID = Session("ID"
'MyDB2.dbMagicCell = "studprog_studid,,ID"
MyDB2.ASPdbPro
%>
You can logon as "demo" at http://wisdomcalls.com/students/logon.asp
Thanks,
Neal Walters
http://walters.km.net
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
|