Jump to content

Recommended Posts

Posted

Boas, como é que eu faço para quando selecionar uma linha no datagridview alterar os dados de uma coluna do tipo int. o que quero fazer é tirar -1 imaginando que tem o valor 1 nessa coluna... o que é suposto fazer é ficar a 0

Desde já, obrigada

Posted (edited)

Para saberes a linha que está selecionada (o indice):

dg.CurrentRow.index;

Para fazeres a atualização:

query = "update from tuatabela set CampoQueQueresAlterar = '" & dg.Item(0, i).Value() & "'  where codigo='1';
//dg.Item(0, i) ; 0 -> indice do campo
			  i -> indice da linha
//o codigo pus 1, adaptas ao indice do campo que tens que alterar
Edited by NunoDinis

Estranha forma de vida que tem a capacidade de transformar comandos em mensagens de erro.

ndsotware.org

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.