Advertisement
Guest User

Untitled

a guest
Jul 1st, 2016
47
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.40 KB | None | 0 0
  1. If Button1.Text = "Add Movie" Then
  2. Button1.Text = "Save Movie"
  3. ComboBox1.Items.Clear()
  4. Me.box()
  5. Me.access()
  6. Button2.Text = "Cancel"
  7. ElseIf TextBox1.Text = "" Then
  8. MsgBox("Please enter movie title", vbCritical, "Add Movie")
  9. TextBox1.Focus()
  10. ElseIf ComboBox1.Text = "- Please Select -" Then
  11. MsgBox("Please select movie category", vbCritical, "Add Movie")
  12. ComboBox1.Focus()
  13. Else
  14. cmd = New SqlClient.SqlCommand
  15. cmd.CommandText = "select * from tblInfo where Title='" & TextBox1.Text & "'"
  16. cmd.Connection = conn
  17. dr = cmd.ExecuteReader
  18. If dr.HasRows Then
  19. MsgBox("Movie has been already watched!", vbExclamation, "Add Movie")
  20. Me.clear()
  21. Else
  22. cmd.CommandText = "Insert Into tblInfo(Title, Category) Values('" & TextBox1.Text & "', '" & ComboBox1.Text & "')"
  23. cmd.ExecuteNonQuery()
  24. MsgBox("Successful Saved!", vbInformation, "Add Movie")
  25. Button1.Text = "Add Movie"
  26. Button2.Text = "Delete Movie"
  27. Me.clear()
  28. Me.box()
  29. Me.unaccess()
  30. Me.showList()
  31. cmd.Dispose()
  32. dr.Close()
  33. End If
  34. End If
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement