Sunday, September 29, 2013

How can Save Tree view Checked and Uncheked node data in database

Hi,


for Checked nodes do it like:



SqlConnection conn = new SqlConnection(strConnString);
con.Open();
foreach (TreeNode item in this.TreeView1.CheckedNodes)
{
string query = "INSERT INTO TableName VALUES ('" + item.Text + "')";
SqlCommand cmd = new SqlCommand(query, conn);
cmd.ExecuteNonQuery();
}
con.Close();









Mitja


No comments:

Post a Comment