本文整理汇总了C#中Microsoft.SqlServer.Server.SqlDataRecord.SetSqlBoolean方法的典型用法代码示例。如果您正苦于以下问题:C# SqlDataRecord.SetSqlBoolean方法的具体用法?C# SqlDataRecord.SetSqlBoolean怎么用?C# SqlDataRecord.SetSqlBoolean使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Microsoft.SqlServer.Server.SqlDataRecord
的用法示例。
在下文中一共展示了SqlDataRecord.SetSqlBoolean方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: BindFile
private static void BindFile(FileInfo _file, SqlDataRecord record)
{
record.SetSqlDateTime(0, _file.Exists ? _file.CreationTime : SqlDateTime.Null);
record.SetSqlDateTime(1, _file.Exists ? _file.LastAccessTime : SqlDateTime.Null);
record.SetSqlDateTime(2, _file.Exists ? _file.LastWriteTime : SqlDateTime.Null);
record.SetSqlBoolean(3, _file.Exists);
record.SetString(4, _file.Name);
record.SetString(5, _file.DirectoryName);
record.SetString(6, _file.Extension);
record.SetSqlInt64(7, _file.Exists ? _file.Length : SqlInt64.Null);
}
示例2: AddParameters
public void AddParameters(IDbCommand command, SqlMapper.Identity identity)
{
var sqlCommand = (SqlCommand)command;
sqlCommand.CommandType = CommandType.StoredProcedure;
var groups = new List<SqlDataRecord>();
var rules = new List<SqlDataRecord>();
SqlMetaData[] groupSqlType =
{
new SqlMetaData("RuleGroupID", SqlDbType.Int),
new SqlMetaData("GroupGuid", SqlDbType.VarChar, 32),
new SqlMetaData("IsSystem", SqlDbType.Bit),
new SqlMetaData("DisplayOrder", SqlDbType.Int),
new SqlMetaData("[Enabled]", SqlDbType.Bit)
};
SqlMetaData[] ruleSqlType =
{
new SqlMetaData("RuleDetailID", SqlDbType.Int),
new SqlMetaData("RuleTypeID", SqlDbType.Int),
new SqlMetaData("GroupGuid", SqlDbType.Char, 32),
new SqlMetaData("RuleConfiguration", SqlDbType.Xml),
new SqlMetaData("[Enabled]", SqlDbType.Bit)
};
foreach (RuleGroup group in this._groups)
{
var groupRecord = new SqlDataRecord(groupSqlType);
string groupGuid = Guid.NewGuid().ToString().Replace("-", string.Empty);
groupRecord.SetInt32(0, group.ID);
groupRecord.SetString(1, groupGuid);
groupRecord.SetBoolean(2, group.IsSystem);
groupRecord.SetInt32(3, group.DisplayOrder);
groupRecord.SetBoolean(4, group.IsEnabled);
groups.Add(groupRecord);
foreach (var rule in group.Rules)
{
var ruleRecord = new SqlDataRecord(ruleSqlType);
var ruleType = (int)rule.RuleTypeID;
ruleRecord.SetInt32(0, rule.ID);
ruleRecord.SetInt32(1, ruleType);
ruleRecord.SetString(2, groupGuid);
ruleRecord.SetString(3, this.RuleWriter(rule));
ruleRecord.SetSqlBoolean(4, rule.IsEnabled);
rules.Add(ruleRecord);
}
}
var userIDParam = sqlCommand.Parameters.Add("UserID", SqlDbType.Int);
userIDParam.Value = this._userID;
var profileIDParam = sqlCommand.Parameters.Add("ProFileID", SqlDbType.Int);
profileIDParam.Value = this._profileID;
var profileNameParam = sqlCommand.Parameters.Add("ProfileName", SqlDbType.VarChar, 50);
profileNameParam.Value = this._profileName;
var groupsPAram = sqlCommand.Parameters.Add("Groups", SqlDbType.Structured);
groupsPAram.TypeName = "RulesGroupTableType";
groupsPAram.Value = groups;
var rulesParam = sqlCommand.Parameters.Add("Rules", SqlDbType.Structured);
rulesParam.TypeName = "RulesTableType";
rulesParam.Value = rules;
}