smaia Posted October 7, 2013 at 07:24 PM Report #527944 Posted October 7, 2013 at 07:24 PM 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" cn.Open() Dim myCmd As New OleDb.OleDbCommand myCmd.Connection = cn myCmd.CommandText = "DELETE FROM Clientes WHERE Nconta = ?????? myCmd.ExecuteNonQuery() MsgBox("Cliente excluido com sucesso!") cn.Close() abraço smaia
Cyber Storm Posted October 12, 2013 at 11:33 PM Report #528699 Posted October 12, 2013 at 11:33 PM Boas, 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.
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now