| 
  • If you are citizen of an European Union member nation, you may not use this service unless you are at least 16 years old.

  • You already know Dokkio is an AI-powered assistant to organize & manage your digital files & messages. Very soon, Dokkio will support Outlook as well as One Drive. Check it out today!

View
 

Lecture - Using a DropdownList with a Database

Page history last edited by Dr. Ron Eaglin 11 years ago

Using a DropdownList with a Database

 

Summary

 

Demonstrates the example of creating a web form with a drop down list. The drop down list is populated from a database view. The return value is then used to call a database stored procedure. Also demonstrated is updating a view that is used in the project.

 

Prerequisite Lectures

 

Calling Stored Procedures from Visual Studio 1

 

Video

 

http://online1.daytonastate.edu/player2.php?id=8c9f32e03aeb2e3000825c8c875c4edd 

 

 

Code

 

Uses Case Study - Registration Database

 

 

 

 

 

 

 

View

 

view_courses

CREATE view [dbo].[view_courses]
AS
 SELECT
 CourseOffering.id,
 term_identifier + [Year] + ' ' +Prefix + Number as 'Course'
 FROM 
 Courses, CourseOffering, Semesters
 WHERE
 Courses.id = CourseOffering.CourseID
 AND
 Semesters.id = COurseOffering.SemesterID 

 

 

 

 

View

 

view_student

create view [dbo].[view_student]
AS
SELECT
 id,
 FirstNameText + ' ' + LastnameText as 'Name'
 FROM 
 Students
 

 

 

 

 

Stored

Procedure

 

create procedure [dbo].[sp_registerStudent]
 @StudentID int,
 @CourseOfferingID int
AS
BEGIN
INSERT INTO StudentEnrollment
 (StudentID, CourseOfferingID)
VALUES 
 (@StudentID, @CourseOfferingID)
END 
   
   
   
   

 

 

Comments (0)

You don't have permission to comment on this page.