-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathHomepage.aspx.vb
More file actions
26 lines (23 loc) · 1.08 KB
/
Homepage.aspx.vb
File metadata and controls
26 lines (23 loc) · 1.08 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
Imports System.Data
Imports System.Data.OleDb
Partial Class Homepage
Inherits System.Web.UI.Page
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
' clear booking status
Dim conn As New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;" & "Data Source=" & Server.MapPath("Database/library.mdb"))
Const status As String = "Available"
Dim cmd As OleDbCommand = New OleDbCommand(String.Format("UPDATE books SET [Status] = @Status where [Status] = 'Booked' AND TglAkhirBooking < @TglAkhirBooking"), conn)
Dim paramStatus = New OleDbParameter("@Status", status)
Dim paramTglAkhirBooking = New OleDbParameter("@TglAkhirBooking", DateTime.Now.ToString("yyyy-MM-dd hh:mm:ss"))
cmd.Parameters.Add(paramStatus)
cmd.Parameters.Add(paramTglAkhirBooking)
Try
conn.Open()
cmd.ExecuteNonQuery()
Catch ex As Exception
Response.Write("UPDATE BOOK ERROR, " & ex.Message)
Finally
conn.Close()
End Try
End Sub
End Class