1
Answer

Delete node in treeview with the same attribute value

Photo of Nbl Bz

Nbl Bz

10y
644
1
Hello ,

Am working on winForm application , I browse an XML file to a TreeView. Then I want to delete some nodes , actually i can select one node then delete it.
My question/problem is :
I have another nodes with the same attribute value
 
<object id="100" name="toto">
  <child id="1200"/>
  <child id="1300"/>
<object/>
<object id="1200" name="toto"/>
 
 
I want to select and delete the object with the id = 1200 , then it's delete also the child with the id =1200.
It's an exemple , so globaly i want to delete all node having the similar id attribute value as the node selected.
it's possible ? if yes how ? can u help me to start this plz Smile | :)

Answers (1)

0
Photo of Santhosh Kumar Jayaraman
NA 9.9k 2.3m 12y
When You are deleting records,

You can write query as

delete table AU_Delete

or
delete from table au_Delete.

you have to use * only in select queries.

try this

 SqlConnection con = new SqlConnection("Data Source=APPLE;Initial Catalog=sam;Integrated Security=True");
            SqlCommand cmd = new SqlCommand();
            cmd.Connection = con;
            con.Open();
            string str1 = "DELETE  AU_Delete";
            cmd.CommandText = str1;
            cmd.ExecuteNonQuery();
            con.Close();
          

0
Photo of Hemant Kumar
NA 3k 215.2k 12y
Mohammed Shamsheer,

you can't write '*' for the delete Statements

string Query="delete from AU_DELETE";
0
Photo of Naresh Avari
NA 811 1.6m 12y
Hi,

Remove '*' from your SQL Query and use

string str1 = "DELETE FROM AU_Delete";

You don't need to specify '*' for DELETE statement.