| |
|||
Код страницы состоит их двух процедур. Первая процедура выполняется при загрузке страницы:
If Not IsPostBack then Dim DBConn as OleDbConnection Dim DBCommand As OleDbDataAdapter Dim DSQuestion as DataSet Dim DBInsert As New OleDbCommand Session("CurrentSequenceNumber") = 1 DBConn = New OleDbConnection("Provider=sqloledb; " _ & "server=localhost;" _ & "Initial Catalog=INETC10;" _ & "User Id=sa;" _ & "Password=yourpassword;") DBInsert.CoiranandText = "Insert Into ObjectOrders " _ & "(DateEntered) values ('" _ & Now() & "')" DBInsert.Connection = DBConn DBInsert.Connection.Open DBInsert.ExecuteNonQuery() DSQuestion = New DataSet() DBCommand = New OleDbDataAdapter _ ("Select Max(ObjectOrderlD) as MaxID " _ & "From ObjectOrders",DBConn) DBCommand.Fill(DSQuestion, _ "CurrentID") Session("ObjectOrderlD") = _ DSQuestion.Tables("CurrentID").Rows(O).Item("MaxID") DBCommand = New OleDbDataAdapter _ ("Select Ob^jectQuestionlD, " _ & "ObjectQuestionText, PicPath, " _ & "PicAltText from ObjectQuestions " _ & "Where Sequence = " _ & Session("CurrentSequenceNumber"),DBConn) DBCommand.Fill(DSQuestion, _ "CurrentQuestion") DBCommand = New OleDbDataAdapter _ ("Select ChoicelD, ChoiceText " _ & "From QuestionChoices " _ & "Where ObjectQuestionID = " _ & DSQuestion.Tables("CurrentQuestion") _ .Rows(O).ItemC'ObjectQuestionID") _ ,DBConn) DBCommand.Fill(DSQuestion, _ "CurrentResponses") IblTitle.BorderWidth = New Unit("7px") IblTitle.BorderStyle = 9 IblTitle.Width = New Unit("90%") IblTitle.Font.Size = New FontUnit("25pt") IblTitle.Font.Name = "Arial" IblTitle.Text = Application("TitleText") imgStepPicture.AlternateText = _ DSQuestion.Tables("CurrentQuestion").Rows(O).Item("Pic AltText") imgStepPicture.ImageUrl = _ DSQuestion.Tables("CurrentQuestion").Rows(0).Item("PiePath") imgStepPicture.BorderWidth = New Unit("7px") IblQuestion.Font.Size = New FontUnit("12pt") IblQuestion,Font.Name = "Verdana" IblQuestion.Text = _ DSQuestion.Tables("CurrentQuestion").Rows(0) _ .Item("ObjectQuestionText") ddlResponses.DataSource = _ DSQuestion.Tables("CurrentResponses").Defaultview ddlResponses.DataBind() End If End Sub
& "(DateEntered) values ('" & Now ()&'")"
DBInsert.Connection.Open
|
|||