本文整理汇总了C#中YAF.Classes.Data.MsSqlDbConnectionManager.CloseConnection方法的典型用法代码示例。如果您正苦于以下问题:C# MsSqlDbConnectionManager.CloseConnection方法的具体用法?C# MsSqlDbConnectionManager.CloseConnection怎么用?C# MsSqlDbConnectionManager.CloseConnection使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类YAF.Classes.Data.MsSqlDbConnectionManager
的用法示例。
在下文中一共展示了MsSqlDbConnectionManager.CloseConnection方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: poll_save
//.........这里部分代码省略.........
{
cmd.Parameters.Add("?PollID{0}".FormatWith(choiceCount1), MySqlDbType.Int32).Value =
myPollID;
cmd.Parameters.Add(String.Format("?Choice{0}", choiceCount1), MySqlDbType.VarChar).
Value
= question.Choice[0, choiceCount1];
cmd.Parameters.Add(String.Format("?Votes{0}", choiceCount1), MySqlDbType.Int32).
Value =
0;
cmd.Parameters.Add(String.Format("?ChoiceObjectPath{0}", choiceCount1),
MySqlDbType.VarChar).Value =
question.Choice[1, choiceCount1].IsNotSet()
? String.Empty
: question.Choice[1, choiceCount1];
cmd.Parameters.Add(String.Format("?ChoiceMimeType{0}", choiceCount1),
MySqlDbType.VarChar).Value =
question.Choice[2, choiceCount1].IsNotSet()
? String.Empty
: question.Choice[2, choiceCount1];
}
}
MsSqlDbAccess.Current.ExecuteNonQuery(cmd, false);
}
sb = new StringBuilder();
// fill a pollgroup field - double work if a poll exists
if (question.TopicId > 0)
{
sb.Append("UPDATE ");
sb.Append(MsSqlDbAccess.GetObjectName("Topic"));
sb.Append(" SET PollID = ?NewPollGroupID WHERE TopicID =?TopicID; ");
}
// fill a pollgroup field in Forum Table if the call comes from a forum's topic list
if (question.ForumId > 0)
{
sb.Append("UPDATE ");
sb.Append(MsSqlDbAccess.GetObjectName("Forum"));
sb.Append(" SET PollGroupID= ?NewPollGroupID WHERE ForumID= ?ForumID; ");
}
// fill a pollgroup field in Category Table if the call comes from a category's topic list
if (question.CategoryId > 0)
{
sb.Append("UPDATE ");
sb.Append(MsSqlDbAccess.GetObjectName("Category"));
sb.Append(" SET PollGroupID = ?NewPollGroupID WHERE CategoryID= ?CategoryID; ");
}
using (MySqlCommand cmdPoll = MsSqlDbAccess.GetCommand(sb.ToString(), true))
{
cmdPoll.Transaction = trans;
cmdPoll.Parameters.Add("?NewPollGroupID", MySqlDbType.Int32).Value = pollGroupId;
if (question.TopicId > 0)
{
cmdPoll.Parameters.Add("?TopicID", MySqlDbType.Int32).Value = question.TopicId;
}
// fill a pollgroup field in Forum Table if the call comes from a forum's topic list
if (question.ForumId > 0)
{
cmdPoll.Parameters.Add("?ForumID", MySqlDbType.Int32).Value = question.ForumId;
}
// fill a pollgroup field in Category Table if the call comes from a category's topic list
if (question.CategoryId > 0)
{
cmdPoll.Parameters.Add("?CategoryID", MySqlDbType.Int32).Value = question.CategoryId;
}
MsSqlDbAccess.Current.ExecuteNonQuery(cmdPoll, false);
}
/*if (ret.Value != DBNull.Value)
{
return (int?)ret.Value;
}*/
trans.Commit();
return pollGroupId;
}
catch (Exception e)
{
trans.Rollback();
throw new Exception(e.Message);
}
finally
{
connMan.CloseConnection();
}
}
}
}
return null;
}