Dim ObjConn As oledbConnection Dim ObjRs As oledbDataReader Dim ObjCmd As oledbCommand Dim DBPos, Antal, i, SideAntal, TotalPris As Integer Dim CheckOutDate as Date Dim NyAntalSolgt As Integer Dim SQLStr As string Dim strRes, strConn, strSQL, strSti as string Dim objDR as OledbDataReader
Sub Page_Load(sender as object, e as eventargs) If not Page.IsPostback Then EventData.DataSource = LoadMyCalendarData EventData.DataBind() End If End Sub
Protected Function LoadMyCalendarData() As DataSet Dim sourceXML as String = Server.MapPath("MyCalendar.xml") If ( Not File.Exists(sourceXML) ) Then Return Nothing End if
Dim cachedDataSet as DataSet = Session("MyCalendarData") if ( Not cachedDataSet Is Nothing ) Then Return cachedDataSet End if
Dim dataSet As DataSet = New DataSet()
Try dataSet.ReadXml(sourceXML) Session("MyCalendarData") = dataSet Catch e As Exception ErrorMessage.Text = e.Message dataSet = Nothing End Try
Return dataSet End Function
Sub DEDR_Edit(sender as object, e as DataGridCommandEventArgs) EventData.EditItemIndex = CInt(E.Item.ItemIndex) EventData.DataSource = LoadMyCalendarData EventData.DataBind() End Sub
Sub DEDR_Update(sender as object, e as DataGridCommandEventArgs) Dim dataSet as DataSet = LoadMyCalendarData Dim row as Integer = CInt(E.Item.ItemIndex) Dim EditText as textbox
EventData.DataSource = LoadMyCalendarData EventData.DataBind() End Sub
Sub DEDR_Cancel(sender as object, e as DataGridCommandEventArgs) EventData.EditItemIndex = -1 Session("MyCalendarData") = Nothing EventData.DataSource = LoadMyCalendarData EventData.DataBind() End Sub
Sub DEDR_Delete(sender as object, e as DataGridCommandEventArgs) Dim dataSet as DataSet = LoadMyCalendarData Dim row as Integer = CInt(E.Item.ItemIndex)
EventData.DataSource = LoadMyCalendarData EventData.DataBind() End Sub
Sub DEDR_Add(sender as object, e as EventArgs) Dim dataSet as DataSet = LoadMyCalendarData Dim newRow as DataRow newRow = dataSet.Tables(0).NewRow() newRow.Item("EventDate") = "" newRow.Item("ShortDesc") = "" newRow.Item("DetailDesc") = "" newRow.Item("StartTime") = "" newRow.Item("EndTime") = "" dataSet.Tables(0).Rows.Add(newRow)
Tilladte BB-code-tags: [b]fed[/b] [i]kursiv[/i] [u]understreget[/u] Web- og emailadresser omdannes automatisk til links. Der sættes "nofollow" på alle links.