SHARE
TWEET

iliminar delect

username_leta Apr 13th, 2019 86 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. Dim ConnectionString As New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0; Data Source=" & Application.StartupPath & "pedro..accdb")
  2. Dim query As String = "DELETE FROM Clientes WHERE ID = @IDCliente"
  3.  
  4. Dim command As New OleDbCommand(query, ConnectionString)
  5.  
  6. ' Elimina apenas o cliente que consta na Textbox
  7. command.Parameters.Add("@IDCliente", OleDbType.Integer).Value = IDClienteTextbox.Text  
  8.  
  9. ConnectionString.Open()
  10.  
  11. Dim x As Integer = command.ExecuteNonQuery()
  12.  
  13. If x < 1 Then
  14.      MessageBox.Show("Erro ao eliminar", My.Application.Info.Title, MessageBoxButtons.OK, MessageBoxIcon.Error)
  15. Else
  16.      MessageBox.Show("Eliminado com sucesso!", My.Application.Info.Title, MessageBoxButtons.OK, MessageBoxIcon.Information)
  17. End If
  18.  
  19. ConnectionString.Close()
  20. command = Nothing
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top