What's Wrong With This?

Submitted by Kleyyr on
  1.  Public Sub loadBooks()
  2.         Try
  3.             Dim cmd As New Odbc.OdbcCommand
  4.             Dim da As New Odbc.OdbcDataAdapter
  5.             Dim ds As New DataSet
  6.  
  7.             cmd.Connection = New Odbc.OdbcConnection(cs)
  8.             cmd.Connection.Open()
  9.             If bookSecName = "Arts" Then
  10.                 cmd.CommandText = "Select * from books where CirculationSection = 'Arts and Sciences'"
  11.             ElseIf bookSecName = "Commerce" Then
  12.                 cmd.CommandText = "Select * from books where CirculationSection = 'Commerce'"
  13.             ElseIf bookSecName = "Computer Science" Then
  14.                 cmd.CommandText = "Select * from books where CirculationSection = 'Computer Science'"
  15.             ElseIf bookSecName = "Education" Then
  16.                 cmd.CommandText = "Select * from books where CirculationSection = 'Education'"
  17.             ElseIf bookSecName = "HRM" Then
  18.                 cmd.CommandText = "Select * from books where CirculationSection = 'Hotel and Restaurant Management'"
  19.             ElseIf bookSecName = "Nursing" Then
  20.                 cmd.CommandText = "Select * from books where CirculationSection = 'Nursing'"
  21.             ElseIf bookSecName = "Tourism" Then
  22.                 cmd.CommandText = "Select * from books where CirculationSection = 'Tourism'"
  23.             ElseIf bookSecName = "Filipiniana" Then
  24.                 cmd.CommandText = "Select * from books where CirculationSection = 'Filipiniana'"
  25.             ElseIf bookSecName = "Rizaliana" Then
  26.                 cmd.CommandText = "Select * from books"
  27.             End If
  28.  
  29.  
  30.             da.SelectCommand = cmd
  31.             da.Fill(ds, "Books")
  32.             bsBook.DataSource = ds.Tables("Books")
  33.             dgbook.DataSource = bsBook
  34.  
  35.             cmd.Connection.Close()
  36.             cmd = Nothing
  37.         Catch ex As Exception
  38.             MessageBox.Show(ex.Message)
  39.         End Try
  40.     End Sub