当前位置: 首页>>代码示例>>C#>>正文


C# SortedList.Substring方法代码示例

本文整理汇总了C#中System.Collections.SortedList.Substring方法的典型用法代码示例。如果您正苦于以下问题:C# SortedList.Substring方法的具体用法?C# SortedList.Substring怎么用?C# SortedList.Substring使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在System.Collections.SortedList的用法示例。


在下文中一共展示了SortedList.Substring方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: DeleteFromDB

        public Boolean DeleteFromDB()
        {
            String modelo, familias, competencias, praticas, perguntas;

            this.loadFull(this.owner, null);

            SqlConnection conn = new SqlConnection(DBHelper.ConnectionString);
            SqlCommand command = new SqlCommand();
            command.Connection = conn;

            // apagar o modelo

            modelo = "delete modelo where id= " + this.modeloID.ToString();
            familias = "delete familia where id in (  ";
            competencias = "delete competencia where id in (  ";
            praticas = "delete Pratica where id in (  ";
            perguntas = "delete Pergunta where id in (  ";
            foreach (FamiliaCompetencias fam in this.familias.Values)
            {
                familias += fam.FamiliaID.ToString() + ",";
                foreach (Competencia comp in fam.Competencias.Values)
                {
                    competencias += fam.FamiliaID.ToString() + ",";
                    foreach (Pratica prat in comp.Praticas.Values)
                    {
                        praticas += prat.PraticaID.ToString() + ",";
                        foreach (Pergunta perg in prat.Perguntas.Values)
                        {
                            perguntas += perg.PerguntaID.ToString() + ",";
                        }
                    }
                }

            }

            competencias = competencias.Substring(0, competencias.Length - 1);
            competencias += ")";

            familias = familias.Substring(0, familias.Length - 1);
            familias += ")";

            praticas = praticas.Substring(0, praticas.Length - 1);
            praticas += ")";

            perguntas = perguntas.Substring(0, perguntas.Length - 1);
            perguntas += ")";

            command.CommandType = CommandType.Text;
            conn.Open();
            try
            {
                command.CommandText = modelo;
                command.ExecuteNonQuery();
                command.CommandText = familias;
                command.ExecuteNonQuery();
                command.CommandText = competencias;
                command.ExecuteNonQuery();
                command.CommandText = praticas;
                command.ExecuteNonQuery();
                command.CommandText = perguntas;
                command.ExecuteNonQuery();
            }
            catch
            {
                conn.Close();
                return false;
            }

            conn.Close();
            return true;
        }
开发者ID:JCanhoto,项目名称:ToolsQtools,代码行数:71,代码来源:ModeloCompetencias.cs


注:本文中的System.Collections.SortedList.Substring方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。