Advertisement
Guest User

Untitled

a guest
Dec 20th, 2014
171
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.86 KB | None | 0 0
  1. Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
  2.  
  3.  
  4. Dim con As New SqlConnection
  5. Dim cmd As New SqlCommand
  6. Dim rd As SqlDataReader
  7. Try
  8.  
  9. con.ConnectionString = "Server=KAVIER;Database=vb;Trusted_Connection=True;"
  10. con.Open()
  11. cmd.Connection = con
  12. rd = cmd.ExecuteReader()
  13.  
  14. cmd.CommandText = "SELECT * FROM music where mus_id = '" & txtid.Text & "' "
  15.  
  16.  
  17. If rd.HasRows Then
  18.  
  19. txtartist.Text = rd.Item("customer")
  20. txtid.Text = rd.Item("album")
  21. txtgenre.Text = rd.Item("genre")
  22. hided.Text = rd.Item("music_copies")
  23. txtprice.Text = rd.Item("price")
  24. txttotal.Text = txtprice.Text * txtwalkinquantities.Text
  25.  
  26. End If
  27. con.Close()
  28. Catch ex As Exception
  29. MsgBox(ex.Message)
  30. End Try
  31.  
  32. End Sub
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement