One major problem in your code is that you're not using parameters. By using them, the could would simplify a lot and keep you safe from SQL injections, conversion problems and so on.
Another thing is the lack of using blocks which should be used in order to dispose objects properly.
Concerning those, have a look at
Properly executing database operations[
^], however keep in mind that you cannot use parameters for table names, only row values.
What comes to the deletion itself, as already pointed out, you always show the message box. But another question is if the Id is used correctly in your criteria? Currently you seem to use the ordinal of a column:
Database1DataSet.Tables(TreeView1.SelectedNode.ToString).Columns("Id").Ordinal.ToString
That always gives the position of the column, not the value of the data. So try removing the ordinal and using the actual value instead. You just have to point the row you want the value from. See
DataTable.Rows Property (System.Data)[
^]