- Public Sub loadBooks()
- Try
- Dim cmd As New Odbc.OdbcCommand
- Dim da As New Odbc.OdbcDataAdapter
- Dim ds As New DataSet
- cmd.Connection = New Odbc.OdbcConnection(cs)
- cmd.Connection.Open()
- If bookSecName = "Arts" Then
- cmd.CommandText = "Select * from books where CirculationSection = 'Arts and Sciences'"
- ElseIf bookSecName = "Commerce" Then
- cmd.CommandText = "Select * from books where CirculationSection = 'Commerce'"
- ElseIf bookSecName = "Computer Science" Then
- cmd.CommandText = "Select * from books where CirculationSection = 'Computer Science'"
- ElseIf bookSecName = "Education" Then
- cmd.CommandText = "Select * from books where CirculationSection = 'Education'"
- ElseIf bookSecName = "HRM" Then
- cmd.CommandText = "Select * from books where CirculationSection = 'Hotel and Restaurant Management'"
- ElseIf bookSecName = "Nursing" Then
- cmd.CommandText = "Select * from books where CirculationSection = 'Nursing'"
- ElseIf bookSecName = "Tourism" Then
- cmd.CommandText = "Select * from books where CirculationSection = 'Tourism'"
- ElseIf bookSecName = "Filipiniana" Then
- cmd.CommandText = "Select * from books where CirculationSection = 'Filipiniana'"
- ElseIf bookSecName = "Rizaliana" Then
- cmd.CommandText = "Select * from books"
- End If
- da.SelectCommand = cmd
- da.Fill(ds, "Books")
- bsBook.DataSource = ds.Tables("Books")
- dgbook.DataSource = bsBook
- cmd = Nothing
- Catch ex As Exception
- MessageBox.Show(ex.Message)
- End Try
- End Sub