Jump to content

Eliminar registo especifico DATAGRIDVIEW

Recommended Posts


Boa noite a todos,

Estou com uma duvida, e peço a vossa ajuda:

Como faço para eliminar uma linha no datagridview que contenha um determinado registo num campo?

Dim cn As New OleDb.OleDbConnection

cn.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\Users\Sandro Maia\Desktop\GCA.mdb"


Dim myCmd As New OleDb.OleDbCommand

myCmd.Connection = cn

myCmd.CommandText = "DELETE FROM Clientes WHERE Nconta = ??????


MsgBox("Cliente excluido com sucesso!")




Share this post

Link to post
Share on other sites
Cyber Storm


ora tenta assim:

myCmd.CommandText = "DELETE FROM Clientes WHERE Nconta = " + DataGridView1.CurrentRow.Cells("NConta").Value.ToString

Sendo DataGridView1 a tua datagridview e "NConta" o nome da coluna no DataGrid.

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Create New...

Important Information

By using this site you accept our Terms of Use and Privacy Policy. We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.