Script won't delete rows in database

Your named query is expecting a parameter id but you are supplying a parameter Customer_ID. Your dictionary of parameters should be {'id': id}.

2 Likes

Using this dataset, and the script below works correctly

table = event.source.parent.getComponent('Customer Power Table')
selRows = table.getSelectedRows()

if len(selRows) > 0:
	if system.gui.confirm("Are you sure you want to delete"):
  		for row in selRows:
  			id = table.data.getValueAt(row,"Customer_ID")
  			print "id: ", id

image

Also, @pturmel is right :smile:

1 Like

Awesome, thanks!

I don’t know why the mismatch in parameters doesn’t generate an error, instead just silently exits with code 0.

Yes, I guess the output of 0, instead of the actual row id should have been my clue… Thanks for your help!

1 Like

It’s not a “code 0”, but a count of the rows affected by the SQL statement.