本文整理汇总了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;
}