| |
|||
Описанная панель содержит два элемента управления. В элементе Label отображается информация для пользователя:
id="lblMessageResults" Font-Size="12pt" Font-Name="Tahoma" Font-Bold="True" Text="Bы уже голосовали по этому вопросу. Текущие результаты голосования." runat="server" />
id="dgResults" Width="90%" BackColor="beige" AlternatingItemStyle-BackColor="cornsilk" BprderColor="black" ShowFooter="false" CellPadding=3 CellSpacing="0" Font-Name="Arial" Font-Size="8pt" ForeColor="Black" HeaderStyle-BackColor="burlywood" Headerstyle-Font-Bold="True" runat="server"> </asp:DataGrid>
If Len(Session("EmployeelD")) = 0 Then Response.Redirect("./index.aspx") End If If Not IsPostBack Then Dim DBConn as OleDbConnection Dim DBCommand As OleDbDataAdapter Dim DSPageData as New DataSet DBConn = New OleDbConnection("Provider=sqloledb;" _ & Server=localhost"; & Initial Catalog=INETC4;" SUser ID=sa;"_ &Password=yourpassword;"_ DBCommand = New OleDbDataAdapter _ ("select QuestionlD, QuestionText " _ & "from VoteQuestions Where VotingGroupID In " _ & "(Select VoteGroupID from VoteEmployeelnGroup " _ & "Where EmployeelD = " & Session("EmployeelD") _ & ")", DBConn) DBCommand.Fill(DSPageData, _ "Questions") ddlQuestionlD.DataSource = _ DSPageData.Tables("Questions").DefaultView ddlQuestionID.DataBind() End If End Sub
("select QuestionlD, QuestionText " _ & "from VoteQuestions Where VotingGroupID In " _ & "(Select VoteGroupID from VoteEmployeelnGroup " _ & "Where EmployeelD = " & Session("EmployeelD") _ & ")", DBConn)
"Questions")
DSPageData.Tables("Questions").DefaultView ddlQuestionID.DataBind()
Dim DBConn as OleDbConnection Dim DBCommand As OleDbDataAdapter Dim DSPageData as New DataSet DBConn - New OleDbConnection("PROVIDER=sqloledb;" & Seryer=localhost;" _ & Initial Catalog-INETCI;" & User ID=sa;"_ & Password=yourpassword;" DBCommand = New OleDbDataAdapter _ ("Select VotelD from Votes " & "Where QuestionID = " _ & ddlQuestionlD.Selectedltem.Value _ & " and EmployeelD = " & Session("EmployeelD") _ , DBConn) DBCommand.Fill(DSPageData, _ "VotesCast") If DSPageData.Tables("VotesCast"). _ Rows.Count = 0 Then pnlVote.Visible - True pnlResults.Visible = False DBCommand = New OleDbDataAdapter _ ("Select AnswerText from VoteAnswers " _ & "Where QuestionID = " _ & ddlQuestionlD.Selectedltem.Value _ & " Order By AnswerText", DBConn) DBCommand.Fill(DSPageData, _ "Answers") ddlAnswers.DataSource - _ DSPageData.Tables("Answers").DefaultView ddlAnswers.DataBind() Else pnlVote.Visible - False pnlResults.Visible - True DBCommand = New OleDbDataAdapter _ ("Select AnswerText as [Ответ], " _ & "Count(VotelD) as [Голосов] From Votes " _ & "Where QuestionID & ddlQuestionlD.Selectedltem.Value _ & " Group By AnswerText Order By " _ & "Count(VotelD) DESC", DBConn) DBCommand.Fill(DSPageData, _ "VoteCount") dgResults.DataSource - _ DSPageData.Tables("VoteCount").DefaultView dgResults.DataBind() End If End Sub |
|||