Results 1 to 3 of 3

Thread: One to Many - Add of the Child Record

  1. #1
    Neal Walters Guest

    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&#34
    MyDB2.dbDSN = "DSN=nwalterssql;UID=xxxxxx;PWD=xxxxx;"
    MyDB2.dbDBType = "SQL"
    MyDB2.dbMode = "grid"


    Session("mySql&#34 = "Select * from studprogress, students where studprog_studid = student_id and student_userid ='" & Session("StudentUserId&#34 & "'"
    Response.Write &#34;Value of Database SQL=[&#34; & Session(&#34;mySql&#34 & &#34;] <br>&#34;

    MyDB2.dbSQL = Session(&#34;mySql&#34
    MyDB2.dbNavigationItem = &#34;top,prev,next,bottom,add,update,edit&#34;
    MyDB2.dbEditParams = &#34;TableName=studprogress,BookMarkFlds=studprog_ id&#34;
    MyDB2.dbEditFlds = &#34;studprog_studid,studprog_lessons,studprog_sel fgrade,studprog_testgrade,studprog_hours,studprog_ comment&#34;

    MyDB2.dbGridDisplayFlds = &#34;studprog_date,studprog_lessons,studprog_selfg rade,studprog_testgrade,studprog_hours,studprog_co mment&#34; &#39;Display only these fields
    MyDB2.dbNameMap = &#34;studprog_date,Date,;&#34; _
    & &#34;studprog_lessons,Lessons,;&#34; _
    & &#34;studprog_studid,Student ID,;&#34; _
    & &#34;studprog_selfgrade,SelfGrade,;&#34; _
    & &#34;studprog_testgrade,TestGrade,;&#34; _
    & &#34;studprog_hours,StudyHours,;&#34; _
    & &#34;studprog_comment,Comment,;&#34;

    &#39;format field as currency and start running total
    ID = Session(&#34;ID&#34
    &#39;MyDB2.dbMagicCell = &#34;studprog_studid,,ID&#34;

    MyDB2.ASPdbPro
    %>


    You can logon as &#34;demo&#34; at http://wisdomcalls.com/students/logon.asp

    Thanks,
    Neal Walters
    http://walters.km.net



  2. #2
    Mark Guest

    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&#39;m using looks like this, where the student id is in a Session variable.


    Set MyDb2=Server.CreateObject(&#34;ASPdb.Pro&#34
    MyDB2.dbDSN = &#34;DSN=nwalterssql;UID=xxxxxx;PWD=xxxxx;&#34;
    MyDB2.dbDBType = &#34;SQL&#34;
    MyDB2.dbMode = &#34;grid&#34;


    Session(&#34;mySql&#34 = &#34;Select * from studprogress, students where studprog_studid = student_id and student_userid =&#39;&#34; & Session(&#34;StudentUserId&#34 & &#34;&#39;&#34;
    Response.Write &#34;Value of Database SQL=[&#34; & Session(&#34;mySql&#34 & &#34;] <br>&#34;

    MyDB2.dbSQL = Session(&#34;mySql&#34
    MyDB2.dbNavigationItem = &#34;top,prev,next,bottom,add,update,edit&#34;
    MyDB2.dbEditParams = &#34;TableName=studprogress,BookMarkFlds=studprog_ id&#34;
    MyDB2.dbEditFlds = &#34;studprog_studid,studprog_lessons,studprog_sel fgrade,studprog_testgrade,studprog_hours,studprog_ comment&#34;

    MyDB2.dbGridDisplayFlds = &#34;studprog_date,studprog_lessons,studprog_selfg rade,studprog_testgrade,studprog_hours,studprog_co mment&#34; &#39;Display only these fields
    MyDB2.dbNameMap = &#34;studprog_date,Date,;&#34; _
    & &#34;studprog_lessons,Lessons,;&#34; _
    & &#34;studprog_studid,Student ID,;&#34; _
    & &#34;studprog_selfgrade,SelfGrade,;&#34; _
    & &#34;studprog_testgrade,TestGrade,;&#34; _
    & &#34;studprog_hours,StudyHours,;&#34; _
    & &#34;studprog_comment,Comment,;&#34;

    &#39;format field as currency and start running total
    ID = Session(&#34;ID&#34
    &#39;MyDB2.dbMagicCell = &#34;studprog_studid,,ID&#34;

    MyDB2.ASPdbPro
    %>


    You can logon as &#34;demo&#34; at http://wisdomcalls.com/students/logon.asp

    Thanks,
    Neal Walters
    http://walters.km.net



  3. #3
    Mark Guest

    One to Many - Add of the Child Record (reply)

    Neal,
    There is a &#34;sneaky&#34; 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&#39;m using looks like this, where the student id is in a Session variable.


    Set MyDb2=Server.CreateObject(&#34;ASPdb.Pro&#34
    MyDB2.dbDSN = &#34;DSN=nwalterssql;UID=xxxxxx;PWD=xxxxx;&#34;
    MyDB2.dbDBType = &#34;SQL&#34;
    MyDB2.dbMode = &#34;grid&#34;


    Session(&#34;mySql&#34 = &#34;Select * from studprogress, students where studprog_studid = student_id and student_userid =&#39;&#34; & Session(&#34;StudentUserId&#34 & &#34;&#39;&#34;
    Response.Write &#34;Value of Database SQL=[&#34; & Session(&#34;mySql&#34 & &#34;] <br>&#34;

    MyDB2.dbSQL = Session(&#34;mySql&#34
    MyDB2.dbNavigationItem = &#34;top,prev,next,bottom,add,update,edit&#34;
    MyDB2.dbEditParams = &#34;TableName=studprogress,BookMarkFlds=studprog_ id&#34;
    MyDB2.dbEditFlds = &#34;studprog_studid,studprog_lessons,studprog_sel fgrade,studprog_testgrade,studprog_hours,studprog_ comment&#34;

    MyDB2.dbGridDisplayFlds = &#34;studprog_date,studprog_lessons,studprog_selfg rade,studprog_testgrade,studprog_hours,studprog_co mment&#34; &#39;Display only these fields
    MyDB2.dbNameMap = &#34;studprog_date,Date,;&#34; _
    & &#34;studprog_lessons,Lessons,;&#34; _
    & &#34;studprog_studid,Student ID,;&#34; _
    & &#34;studprog_selfgrade,SelfGrade,;&#34; _
    & &#34;studprog_testgrade,TestGrade,;&#34; _
    & &#34;studprog_hours,StudyHours,;&#34; _
    & &#34;studprog_comment,Comment,;&#34;

    &#39;format field as currency and start running total
    ID = Session(&#34;ID&#34
    &#39;MyDB2.dbMagicCell = &#34;studprog_studid,,ID&#34;

    MyDB2.ASPdbPro
    %>


    You can logon as &#34;demo&#34; 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
  •