❔ Help in sql client query Update
In the image as you see thats my datagridview and when i click on the button it will change all Acoes to "Validado", but i wanted just the row that the button is in , what and how can i do this?
This is the statment i have
21 Replies
is that
id
meant to represent the row's identifying acaoID
if so, and it is the selected rows acaoID
, you need to use it in the UPDATE
statementi would love to get that idProjetos
i mean
acaoID yes
if you run that code, what is the value of
id
you're parsing it, but not using ithttps://gyazo.com/c6e43dd7198fccf716899b51265391b9
This is what happend
Gyazo
Gyazo
it changes all data there to Validado
of course, as your statement is to update every row in
tbl_acoes
put a breakpoint (f9) on con.Open();
and run it againsays id 0
and how are you binding you data to the datagrid
like this
It's been a hot minute since I've used datatables, but if you breakpoint after the
dt.Load....
what kind of values can you see
but in essence, it should be easy to get the acaoID
of the row that you clickedbut is it in the event?
datacell click?
yes, but the data in
dataGridViewAcoesPendentes
is what's being populated there
so when you reference the datatable in your dataGridViewAcoesPendentes_CellClick_2
handler, you should be able to get the data inside the selected row
that's why I wanted to see what's inside the dt
in your LoadAcoesPendentes
methodBut i call it everywhere
call what?
dataGridViewAcoesPendentes
that's fine
Isn't this sql command that i need to add something?
yes, you want to update a specific row
not all the rows
which is the row you clicked
Looks like nothing has happened here. I will mark this as stale and this post will be archived until there is new activity.
Well, i have this code right now but the update sql is still the same and im gonna place here how my tables are so it can help you guys more to understand what i need from this.
The SQL statement