Advertisement
Guest User

Untitled

a guest
Apr 4th, 2016
58
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.04 KB | None | 0 0
  1. Private Sub Form9_Load(sender As Object, e As EventArgs) Handles MyBase.Load
  2. 'This should work and can't find why it doesn't
  3. NoMovies.Visible = False
  4. Result.Visible = False
  5. Dim query As String
  6. Dim ds As New DataSet
  7. MysqlConn = New MySqlConnection
  8. 'another query and a two table join
  9. MysqlConn.ConnectionString = "server=mysql.scss.tcd.ie;userid=murpha83;password=gh8ht6789;database=murpha83_db"
  10. MysqlConn.Open()
  11. query = "SELECT movie_name from movie2 Where movie_id=" & _
  12. "(SELECT movie_id from rental where client_username= @name AND start_date<= @date AND return_date>= @date"
  13. Using cmd = New MySqlCommand(query, MysqlConn)
  14. cmd.Parameters.AddWithValue("@name", currentUser)
  15. cmd.Parameters.AddWithValue("@date", DateTime.Now)
  16. Dim da = New MySqlDataAdapter(cmd).Fill(ds)
  17. Result.DataSource = ds.Tables(0)
  18. If ds.Tables.Count = 0 Then
  19. Result.Visible = False
  20. NoMovies.Visible = True
  21. End If
  22. End Using
  23. MysqlConn.Close()
  24. End Sub
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement