| |
|||
Код, который мы рассмотрим в настоящем разделе, предназначен для вывода на экран содержимого выбранного раздела по одной странице. Страница Материалы курса содержит два элемента управления Label. В первом отображается название раздела:
id="lblTitle" BorderWidth="7px" BorderStyle=7 Width=" 90%" Font-Size="25pt" Font-Naine="Tahoma" runat=" server" />
id="lblMessage" Font-Size="12pt" Font-Name="Tahoma" Font-Bold="True" runat=" server" />
id="butOK" text=" OK " Type=" Submit" OnClick="SubmitBtn_Click" runat=" server"
If Len (Session ("StudentID" )) = 0 Then Response. Redirect (" . /index. aspx") End If If Len (Session ("CourseSectionID") ) = 0 Then Response. Redirect (" ./home_room.aspx") End If If Not IsPostBack Then Dim DBConn as OleDbConnection Dim DBCommand As OleDbOataAdapter Dim DSPageData as New DataSet DBConn = New OleDbConnection ("Provider=sqloledb; " _ & "server=localhost;" & "Initial Catalog=INETC9;" & "User Id=sa;" _ & "PassWord=yourpassword;") DBComiaarad = ;New OleDbDataAdapter _ ("Select SectionName from CourseSections Where " _ & "CourseSectionID . - " & Session ("CourseSectipnlD") , DBConn) DBCommand.Fill(DSPageData, _ "SectionName") IblTitle.Text = "<сеntег>Раздел " _ & DSPageData.Tables("SectionName"). _ Rows(O).Item("SectionName") _ & "</center>" DBCommand = New OleDbDataAdapter _ ("Select SectionContentID, SectionContentTitle, " _ & "SectionContent from SectionContents Where " _ & "SectionContentID = (Select Min(SectionContentID) " _ & "From SectionContents Where CourseSectionID - " _ & Session("CourseSectionID") & ")", DBConn) DBCommand.Fill(DSPageData, _ "SectionContent") Session("CurrentSectionContentlD") = _ DSPageData.Tables("SectionContent"). Rows(0).Item("SectionContentID") IblMessage.Text = DSPageData.Tables("SectionContent"). _ Rows(0).Item("SectionContentTitle") & "<br><br>" _ & DSPageData.Tables("SectionContent"). _ Rows(O).Item("SectionContent") End If End Sub |
|||