the answer may be funny but let me help
try this code now
string MyString = "INSERT INTO details(name,parentname) values('" + textBox1.Text + "','" + getNodeid(treeView1.SelectedNode.ToString()) + "')";
please check the syntax you have give.. be careful about the singe quote and multiple .. always make sure to close the data reader if any..