当前位置:Gxlcms > 数据库问题 > 通过List<String>动态传递参数给 sqlcommand.Parameters

通过List<String>动态传递参数给 sqlcommand.Parameters

时间:2021-07-01 10:21:17 帮助过:2人阅读

void GetallChecked_TreeNote(TreeNodeCollection aNodes, ref int TotalNodeCount, ref List<string> listItem) { foreach (TreeNode iNode in aNodes) { if (iNode.Nodes.Count == 0 && iNode.Checked==true) { richTextBox_tabPage1.AppendText("名称:" + iNode.Name + " | " + "Caption:" + iNode.Text + " | " + "Index:" + iNode.Index.ToString() + "\n"); TotalNodeCount = TotalNodeCount + 1; listItem.Add(iNode.Text); } ; if (iNode.Nodes.Count > 0) { GetallChecked_TreeNote(iNode.Nodes, ref TotalNodeCount,ref listItem); } } }

 

调用

 private void button2_Click(object sender, EventArgs e)
        {
            int TotalNodeCount;
           
          
            List<string> listItem = new List<string>();
            TotalNodeCount=0;
            richTextBox_tabPage1.AppendText("TotalNode in the treeView1_UserGroup: " + treeView1_UserGroup.GetNodeCount(true).ToString()+"\n");
            if (treeView1_UserGroup.Nodes.Count>0)
            {
                GetallChecked_TreeNote(treeView1_UserGroup.Nodes, ref TotalNodeCount,ref listItem);
            }
            richTextBox_tabPage1.AppendText("Total Selected Nodes : " + TotalNodeCount.ToString() + "\n");
            richTextBox_tabPage1.AppendText("Selected Nodes : " + string.Join(",",listItem.ToArray())+ "\n");
            richTextBox_tabPage1.AppendText("Selected Nodes : " + string.Concat("", string.Join(",", listItem.ToArray()),"") + "\n");
            richTextBox_tabPage1.AppendText("Selected Nodes : " + string.Join(",", listItem.Select(x => "" + x + "").ToArray()) + "\n");
  }

 

动态 传递给sqlparamter

<略>

通过List<String>动态传递参数给 sqlcommand.Parameters

标签:

人气教程排行