DOC PREVIEW
EIU CIS 3000 - VB2

This preview shows page 1-2-3-4-5-6 out of 18 pages.

Save
View full document
View full document
Premium Document
Do you want full access? Go Premium and unlock all 18 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 18 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 18 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 18 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 18 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 18 pages.
Access to all documents
Download any document
Ad free experience
Premium Document
Do you want full access? Go Premium and unlock all 18 pages.
Access to all documents
Download any document
Ad free experience

Unformatted text preview:

The Registration DatabaseSample Problem 1Slide 3Pseudocode for Problem 1Visual Basic for Problem 1Sample Problem 2Slide 7Slide 8Slide 9Pseudocode for Problem 2Visual Basic for Problem 2Practice Problem 3Sample Problem 3Slide 14Pseudocode for Problem 3Visual Basic for Problem 3Practice Problem 4Practice Problem 5The Registration DatabaseStu-Class info:•SSN FK•CourseID FK•Section FK•GradeStudent info:•SSN•Name•Address•Major•Cum hours•Cum pointsClass info:•Course ID FK•Section•Building•Room•Days•Start Time•End Time•No Enrolled•Inst SSN FKCourse info:•Course ID•Title•CreditInstructor info:•Instructor SSN•Instructor Name•E-mail•other stuff1:MM:11:MM: 1Sample Problem 1•Assume the user has keyed in a course ID and section in txtCourseID and txtSection respectively. •Write the pseudocode and Visual Basic to print the social security number of all students who have registered for that class in a list box named lstStudentsSample Problem 1•In this example, we need the following fields:–Course ID–Section–Social Security Number (student)•Since all of these fields are available on the student class table, we only need to use that one tablePseudocode for Problem 1Find the first record on the StuClass table for the courseID and section in the textboxesLoop while a record on the StuClass table for the courseID and section was found Print the student’s social security number in the picture boxFind the next record on the StuClass table for the courseID and Section in the textboxesEnd the LoopWe need to use a loop since the student class table is NOT being read by the entire primary key. See presentation 1 if you do not remember this!Visual Basic for Problem 1 Dim strFind As String strFind = “[CourseID] = '” & txtCourseID.text & “' and [Section] = '” & txtSection.text & “'” datStuClass.Recordset.FindFirst strFind Do While datStuClass.Recordset.NoMatch = False lstStudents.AddItem datStuClass.Recordset.Fields("SSN") datStuClass.Recordset.FindNext strFind LoopDid you remember how to read an Access table by a composite key?Sample Problem 2•Assume the user has keyed in a course ID and section in txtCourseID and txtSection respectively. •Write the pseudocode and Visual Basic to print the names of all students who have registered for that class in a list box named lstStudentsSample Problem 2•Assume the user has keyed in a course ID and section in txtCourseID and txtSection respectively. •Write the pseudocode and Visual Basic to print the names of all students who have registered for that class in a list box named lstStudentsSample Problem 2•In this example, we need the following fields:–Course ID–Section–Name of student•The name of the student is ONLY on the student table•The Course ID and Section are on the Student Class and Class tables. The course ID is also on the Course table.•We must use the Student table (for the name). Looking at the registration database, the Student Class table is the “closest” to the student table that has the course ID and Section. •We will use the Student and the Student Class tables in this example.Sample Problem 2•You will need two data controls:–datStudent which points to the student table in the registration database–datStuClass which points to the student class table in the registration database•The user types in the course ID and Section. This is the only information that we have at the start – so the student class table is where the pseudocode will start.•The SSN on the student class table is the link between the student class table and the student table.Pseudocode for Problem 2Find the first record on the StuClass table for the courseID and section in the textboxesLoop while a record on the StuClass table for the courseID and section was found Find the first (and only) record in the student table for the SSN on the StuClass tableIF the record was found on the STUDENT table, add the student’s name to the list box; otherwise add the student’s social security number to the list box.Find the next record on the StuClass table for the courseID and Section in the textboxesEnd the LoopNotice: A DO LOOP is used to check for nomatch on the student class table because the student class table is NOT read by the entire Primary Key; An IF statement is used to check for nomatch on the student table because the student table is read by the entire Primary KeyVisual Basic for Problem 2 Dim strFind As String Dim strFind2 As String Dim strSSN As String strFind = “[CourseID] = '” & txtCourseID.text & “' and [Section] = '” & txtSection.text & “'” datStuClass.Recordset.FindFirst strFind Do While datStuClass.Recordset.NoMatch = False strSSN = datStuClass.Recordset.Fields("SSN") strFind2 = "[SSN] = '" & strSSN & "'" datStudent.Recordset.FindFirst strFind2 If datStudent.Recordset.NoMatch = False Then lstStudents.AddItem datStudent.Recordset.Fields("Name") Else lstStudents.AddItem datStuClass.Recordset.Fields(“SSN”) End If datStuClass.Recordset.FindNext strFind LoopPractice Problem 3•Assume the user has typed in a student’s social security number in txtSSN.•Write the Visual Basic to–Print the student’s name in picName–Print the courseIDs and Sections in which the student is enrolled in picClassesSample Problem 3•In this example, we need the following fields:–Course ID–Section–Name of student•The name of the student is ONLY on the student table•The Course ID and Section are on the Student Class and Class tables. The course ID is also on the Course table.•We must use the Student table (for the name). Looking at the registration database, the Student Class table is the “closest” to the student table that has the course ID and Section. •We will use the Student and the Student Class tables in this example.Sample Problem 3•You will need two data controls:–datStudent which points to the student table in the registration database–datStuClass which points to the student class table in the registration database•The user types in the Social Security Number. This is the only information that we have at the start – so the student class table is where the pseudocode will start.•The SSN on the student table is the link between the student table and the student class table.Pseudocode for


View Full Document

EIU CIS 3000 - VB2

Download VB2
Our administrator received your request to download this document. We will send you the file to your email shortly.
Loading Unlocking...
Login

Join to view VB2 and access 3M+ class-specific study document.

or
We will never post anything without your permission.
Don't have an account?
Sign Up

Join to view VB2 2 2 and access 3M+ class-specific study document.

or

By creating an account you agree to our Privacy Policy and Terms Of Use

Already a member?